const compose = (...fns) =>
fns.reduceRight((prevFn, nextFn) =>
(...args) => nextFn(prevFn(...args)),
value => value
);
const EXTENSION_TYPE = { | |
0x01: 'PlainText', | |
0xF9: 'GraphicControl', | |
0xFE: 'Comment', | |
0xFF: 'Application' | |
}; | |
/** | |
* Returns total length of data blocks sequence | |
* |
// The polling function | |
function poll(fn, timeout, interval) { | |
var endTime = Number(new Date()) + (timeout || 2000); | |
interval = interval || 100; | |
var checkCondition = function(resolve, reject) { | |
var ajax = fn(); | |
// dive into the ajax promise | |
ajax.then( function(response){ | |
// If the condition is met, we're done! |
import R from 'ramda'; | |
const items = [ | |
{id: 1, name: 'Al', country: 'AA'}, | |
{id: 2, name: 'Connie', country: 'BB'}, | |
{id: 3, name: 'Doug', country: 'CC'}, | |
{id: 4, name: 'Zen', country: 'BB'}, | |
{id: 5, name: 'DatGGboi', country: 'AA'}, | |
{id: 6, name: 'Connie', country: 'AA'}, | |
]; |
^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$
- Semantic versioning http://semver.org/
- Source of the regex npm/node-semver#32
var fs = require('fs'); | |
var dirname = '/some-dir/'; | |
function onFileContent(filename, content) { | |
if (!/\.(js|md|txt)$/.test(filename)) { | |
return false; | |
} | |
var str = filename + '\n\n' + content + '\n\n\n\n\n'; | |
console.log(str); |
function reflexive(x) {
return x != x;
}
reflexive(NaN)
function transitive(x,y,z) {
return x && x == y && y == z && x != z;
I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.
I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.
Chrome 51 has some pretty wild behaviour related to console.log
in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.
Disclaimer 1: Первую которая "про то чего мы достигли" я таки пропустил.
Disclaimer 2: Многие доклады смотрелись и отчёты писались в состоянии алкогольного опьянения.
Сейчас посмотрел Ben Alpert - What Lies Ahead она про то какие идеи они имеют о дальнейшем развитии. И они делят на UX-идеи и DX-идеи. В UX у них:
const MODULE_NAME = 'base-app/events/' | |
export const CONNECT_WS = MODULE_NAME.concat('CONNECT_WS') | |
export const DISCONNECT_WS = MODULE_NAME.concat('DISCONNECT_WS') | |
export const SUBSCRIBE_WS = MODULE_NAME.concat('SUBSCRIBE_WS') | |
export const UNSUBSCRIBE_WS = MODULE_NAME.concat('UNSUBSCRIBE_WS') | |
export const EMIT_WS = MODULE_NAME.concat('EMIT_WS') | |
export const NEW_EVENT = MODULE_NAME.concat('NEW_EVENT') | |
export const ADD_EVENT = MODULE_NAME.concat('ADD_EVENT') |