I hereby claim:
- I am yefremov on github.
- I am yefremov (https://keybase.io/yefremov) on keybase.
- I have a public key ASA2nE5PKBOyqw-c-V_wcWJ_nGgrn0k78saYFX9RAvItAwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// | |
// count.c | |
// | |
// Based on a a Duff's device | |
// https://pusher.com/sessions/meetup/the-realtime-guild/realtime-stream-processing-with-coroutines | |
// | |
#define go static int __resume__ = 0; \ | |
if (__resume__) goto __RESUME__; |
// | |
// coro.c | |
// | |
// Based on a a Duff's device | |
// https://pusher.com/sessions/meetup/the-realtime-guild/realtime-stream-processing-with-coroutines | |
// | |
/* | |
* Coroutine. |
// Data Science Math Skills | |
// https://www.coursera.org/learn/datasciencemathskills/home/welcome | |
// Sigma summation | |
function sigma(n, i, f) { | |
var sum = 0; | |
while (i <= n) { | |
sum += f(i++); | |
} |
function report() { | |
try { | |
return { | |
userAgent: 'navigator' in window && navigator.userAgent, | |
timing: 'performance' in window && performance.timing, | |
navigation: 'performance' in window && performance.navigation, | |
chrome: 'chrome' in window && chrome.loadTimes(), | |
serviceWorker: 'serviceWorker' in navigator, | |
}; |
// https://github.com/kriskowal/q/blob/d373079d3620152e3d60e82f27265a09ee0e81bd/q.js#L101-L248 | |
// Use the fastest possible means to execute a task in a future turn | |
// of the event loop. | |
var nextTick = (function () { | |
var head = {task: null, tail: null}; | |
var tail = head; | |
var flushing = false; |
// | |
// https://www.youtube.com/watch?v=2jp8N6Ha7tY | |
// | |
// Capitalize the first letter of a string, or all words in a string. | |
function capitalize(str) { | |
return str.charAt(0).toUpperCase() + str.substring(1); | |
} |
/** | |
* Capitalize the first letter of a string, or all words in a string. | |
* | |
* @param {string} | |
* @returns {string} | |
* @example | |
* | |
* capitalize('foo bar baz'); | |
* => "Foo bar baz" |
// How does one write a JavaScript meta-program that can operate reliably on | |
// other objects in its JavaScript context (in a browser – within the same | |
// frame), despite the loading of arbitrary code later into that same frame? | |
// The problem is that the later code may arbitrarily modify, override, or | |
// remove methods on the primordial built-in objects. To make the problem | |
// tractable, we assume that the meta program consists of modules that are | |
// first evaluated before their frame has become corrupted. | |
function uncurryThis(func) { |
function iterate(iterable) { | |
var index = -1; | |
return function next() { | |
return ++index < iterable.length ? iterable[index] : null; | |
} | |
}; | |
function makeIterator(iterable) { | |
var index = -1; |