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 / .bash_aliases
Last active November 14, 2021 18:35
Poland git
function пше () {
case $1 in
курва )
shift;
git commit $@;;
@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 / 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 / gist:7626765
Created November 24, 2013 12:31
check generator support in javascript
var supported = true;
try {
eval('(function *() {})');
} catch (e) {
supported = false;
}
console.log(supported);
@wtfil
wtfil / gist:6935834
Created October 11, 2013 14:40
Unique elements of array
function uniq(array) {
return array.filter(function (val, index) {
return array.indexOf(val) === index;
});
}
@wtfil
wtfil / gist:6523125
Last active December 22, 2015 19:59
ES6 generators with "suspend" module
var suspend = require('suspend'),
fs = require('fs');
suspend(function *(resume){
var users = yield fs.readdir('/Users', resume);
console.log(users);
})();
@wtfil
wtfil / gist:6523011
Last active December 22, 2015 19:59
ES6 generator usage with co library
var co = require('co'),
fs = require('fs'),
read = co.wrap(fs.readdir);
co(function *(){
var users = yield read('/Users');
console.log(users);
});
{
get: {..},
routeMatches: [..],
res: instanceOfResponce
}
{
get: {..},
routeMatches: [..],
res: instanceOfResponce
}