Mistři v programování na #hovnokod

Nepotřebuje komentář ;)

export const hour = [
  { value: '', label: '' },
  { value: '12', label: '12' },
  { value: '1', label: '1' },
  { value: '2', label: '2' },
  { value: '3', label: '3' },
  { value: '4', label: '4' },
  { value: '5', label: '5' },
  { value: '6', label: '6' },
  { value: '7', label: '7' },
  { value: '8', label: '8' },
  { value: '9', label: '9' },
  { value: '10', label: '10' },
  { value: '11', label: '11' },
];

export const minute = [
  { value: '', label: '' },
  { value: '0', label: '00' },
  { value: '1', label: '01' },
  { value: '2', label: '02' },
  { value: '3', label: '03' },
  { value: '4', label: '04' },
  { value: '5', label: '05' },
  { value: '6', label: '06' },
  { value: '7', label: '07' },
  { value: '8', label: '08' },
  { value: '9', label: '09' },
  { value: '10', label: '10' },
  { value: '11', label: '11' },
  { value: '12', label: '12' },
  { value: '13', label: '13' },
  { value: '14', label: '14' },
  { value: '15', label: '15' },
  { value: '16', label: '16' },
  { value: '17', label: '17' },
  { value: '18', label: '18' },
  { value: '19', label: '19' },
  { value: '20', label: '20' },
  { value: '21', label: '21' },
  { value: '22', label: '22' },
  { value: '23', label: '23' },
  { value: '24', label: '24' },
  { value: '25', label: '25' },
  { value: '26', label: '26' },
  { value: '27', label: '27' },
  { value: '28', label: '28' },
  { value: '29', label: '29' },
  { value: '30', label: '30' },
  { value: '31', label: '31' },
  { value: '32', label: '32' },
  { value: '33', label: '33' },
  { value: '34', label: '34' },
  { value: '35', label: '35' },
  { value: '36', label: '36' },
  { value: '37', label: '37' },
  { value: '38', label: '38' },
  { value: '39', label: '39' },
  { value: '40', label: '40' },
  { value: '41', label: '41' },
  { value: '42', label: '42' },
  { value: '43', label: '43' },
  { value: '44', label: '44' },
  { value: '45', label: '45' },
  { value: '46', label: '46' },
  { value: '47', label: '47' },
  { value: '48', label: '48' },
  { value: '49', label: '49' },
  { value: '50', label: '50' },
  { value: '51', label: '51' },
  { value: '52', label: '52' },
  { value: '53', label: '53' },
  { value: '54', label: '54' },
  { value: '55', label: '55' },
  { value: '56', label: '56' },
  { value: '57', label: '57' },
  { value: '58', label: '58' },
  { value: '59', label: '59' },
];

Anonymous,


Anonymous,

parsovani barvy a casu jako za krale Klacka

rgba = function(color) {
    var m;
    if (String(color).match(/^\#\w{8}/)) {
        m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})(\d+)$/i.exec(color);
        return 'rgba(' + parseInt(m[1], 16) + ', ' + parseInt(m[2], 16) + ', ' + parseInt(m[3], 16) + ', ' + (parseInt(m[4], 10) / 100) + ')';
    }

    return color;
};

getTime = function(str, offset) {
    var t, p;

    if (!str) {
        return null;
    }

    if (str.match(/s$/) || str.match(/^\d+\.\d+$/)) {
        t = parseFloat(str) * 1000;

    } else {
        p = String(str).split(/\,|\.|\:/);
        t = Math.round(((parseInt(p[0], 10) * 3600000) + (parseInt(p[1], 10) * 60000) + (parseInt(p[2], 10) * 1000) + parseInt(p[3], 10)));
    }

    if (offset) {
        t += offset;
    }

    return t;
};

Anonymous,


Anonymous,

ked zakaznik si pise kod.

import apiClient from '../../common/services/apiClient';
import { hasInternalCookie } from '../../config';

const { initWidget } = window;

export default {
  getPartnerTokenAndInitWidget: (cookies) => {
    if (hasInternalCookie(cookies)) {
      // convert id token to partner token and initialize Growth Engine widget
      return apiClient
        .put('/user/id-token')
        .then(res => {
          initWidget({
            community: 'myCommunity',
            authenticationToken: res.data.idToken,
          });
        });
    }
  },
};

Anonymous,