Skip to content

Instantly share code, notes, and snippets.

View wtfil's full-sized avatar

Evgen Filatov wtfil

  • London, UK
View GitHub Profile
@wtfil
wtfil / esnextbin.md
Last active October 9, 2016 17:03
esnextbin sketch
@wtfil
wtfil / index.js
Created March 30, 2016 12:05
cached promise
function readHugeData() {
readHugeData.promise = readHugeData.promise || asyncCallAsPromise();
return readHugeData.promise;
}
@wtfil
wtfil / index.js
Last active July 7, 2017 16:55
injection of redux's dispatch in react-router's onEnter hook
/*
* common react, redux staff here
*/
import {Router, createRoutes} from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import rawRoutes from './routes';
import store from './store';
function mixStoreToRoutes(routes) {
return routes && routes.map(route => ({
@wtfil
wtfil / index.js
Last active August 29, 2015 14:20
es6 destructuring
function someAction({x, y, z}) {
console.log('x:', x);
console.log('y:', y);
console.log('z:', z);
}
someAction({
y: 1,
z: 2
});
@wtfil
wtfil / index.js
Created May 4, 2015 10:38
promises
// nested
callA().then(function () {
return callB().then(function () {
return callC()
});
});
// equivalent
@wtfil
wtfil / gulpfile.js
Last active September 15, 2015 09:49
var browserify = require('browserify');
var watchify = require('watchify');
var gutil = require('gulp-util');
var fs = require('fs')
var files = {
js: {
src: 'path to src',
dst: 'path to dst'
}
@wtfil
wtfil / .bash_aliases
Last active November 14, 2021 18:35
Poland git
function пше () {
case $1 in
курва )
shift;
git commit $@;;
@wtfil
wtfil / arduino-motors.ino
Created July 19, 2014 09:49
arduino-motors
#include <Servo.h>
int MOTOR_PIN = 9;
int MIN = 1000;
int MAX = 2000;
@wtfil
wtfil / command_line
Last active August 29, 2015 14:03
open page of current branch in browser
> ./open-remote.sh
@wtfil
wtfil / script.js
Created June 17, 2014 12:20
generators for async flow
var Promise = require('davy');
//get user as promise
function getUser() {
return new Promise(function (resolve) {
setTimeout(function () {
resolve('user name');
}, 1000);
});
}