Skip to content

Instantly share code, notes, and snippets.

View klimashkin's full-sized avatar
🚀
Skyrocketing

Pavel Klimashkin klimashkin

🚀
Skyrocketing
  • Illumio
  • Mountain View, CA
View GitHub Profile
@klimashkin
klimashkin / parseencodeBenchmark.js
Created January 2, 2020 23:54
Testing JSON/CBOR/MessagePack
/* eslint-disable */
const zlib = require('zlib');
const chalk = require('chalk');
let encode;
let decode;
let objEncoded;
let timeString;
const obj = {"result":{"skip":30,"count":873404,"photos":[{"s":5,"cid":1027669,"file":"e/d/1/ed1gex85ezaosljs9c.jpg?s=36ede5bca1","mime":"image/jpeg","title":"Liberazione di Roma","year":1944,"rs":[2436,2434,111]},{"s":5,"cid":1027662,"file":"x/l/y/xly08hxll6uppbx3vf.jpg?s=7cd564c0cd","mime":"image/jpeg","title":"Vue prise de la Terrasse de l'Hôtel des Anglais","year":1893,"rs":[1755,1750,818]},{"s":5,"cid":1027625,"file":"q/9/u/q9uw4l86ahaeowof27.jpg?s=625212031e","mime":"image/jpeg","title":"Вид на перекрёсток улицы Олеко Дундича и Бухарестской улицы","year":1996,"ccount":1,"rs":[703,5,1]},{"s":5,"cid":1027182,"file":"5/z/f/5zfhna3gmxlx0r74c1.jpg?s=02ff72f981","mime":"image/jpeg","title":"Брейк-данс на Арбате","year":1994,"rs":[396,3,1]},{"s":5,"cid":1017368,"file":"0/z/c/0zchyf4fdhuee3jej7.jpg?s=d063ce62ae","mime":"image/jpeg","title":"Площадь перед административным ко
@klimashkin
klimashkin / Button.css
Last active September 10, 2018 22:01
CSS-modules theming simple example with localIdentName: '[name]_[local]'
.button { /* Real classname: 'Button_button' */
position: relative;
display: inline-flex;
justify-content: center;
align-items: center;
line-height: 1.25;
cursor: pointer;
user-select: none;
border: none;
}
@klimashkin
klimashkin / gist:7bbbea885f5b4a556512035934fdaa52
Created July 25, 2017 22:02
Native implementation of Bluebird's Promise.props with flow annotation
function props<A, O: { [key: string]: A }>(promises: O): Promise<$ObjMap<O, typeof $await>> {
const objMapping: {[number]: string} = {};
return Promise
.all(Object.keys(promises).map((key: string, index: number) => {
objMapping[index] = key;
return promises[key];
}))
.then(fulfilledArray => {
'padding-line-between-statements': [2,
// Always require blank lines after directive (like 'use-strict'), except between directives
{blankLine: 'always', prev: 'directive', next: '*'},
{blankLine: 'any', prev: 'directive', next: 'directive'},
// Always require blank lines after import, except between imports
{blankLine: 'always', prev: 'import', next: '*'},
{blankLine: 'any', prev: 'import', next: 'import'},
// Always require blank lines before and after every sequence of variable declarations and export
{blankLine: 'always', prev: '*', next: ['const', 'let', 'var', 'export']},
{blankLine: 'always', prev: ['const', 'let', 'var', 'export'], next: '*'},
@klimashkin
klimashkin / server.config.js
Last active October 14, 2015 19:21
Babel config for NodeJS 4.x
{
compact: false,
optional: [
// 'runtime', // Don't use runtime, it's overabundant in case of Node 4 and bluebirdCoroutines
// 'asyncToGenerator', // Use bluebirdCoroutines on server because we have blubird on server, not client
'bluebirdCoroutines', // Use it for async/await on server-side instead of babel helper asyncToGenerator
'es6.spec.modules',
'es7.asyncFunctions',
'es7.classProperties',
'es7.comprehensions',