I hereby claim:
- I am modernserf on github.
- I am modernserf (https://keybase.io/modernserf) on keybase.
- I have a public key whose fingerprint is 5D74 D20E 86E2 2415 4BDB F497 CBD8 98BF E95C B0A5
To claim this, I am signing this object:
| class DietActiveRecord { | |
| public static function all( $select = null ){ | |
| $self = get_called_class(); | |
| $query = 'SELECT '. $self::select_string($select) . | |
| ' FROM '. $self::$table_name; | |
| return $self::query($query, null, true); | |
| } | 
| fs = require 'fs' | |
| file_path = __INSERT_FILE_PATH_HERE__ | |
| fs.readFile file_path, {encoding: 'utf-8'}, (err, data)-> | |
| # global document object | |
| doc = { | |
| tab_size: 2 | |
| lines: data.split("\n") | |
| } | 
I hereby claim:
To claim this, I am signing this object:
| // using asynquence+iterable sequences | |
| var domready; | |
| ASQ() | |
| // wait for `domready` before we proceed | |
| .seq( domready = ASQ.iterable() ) | |
| .gate( | |
| requestJSON( "foo.json" ), | |
| requestJSON( "bar.json" ) | 
| function debouncePromise (func, wait){ | |
| var later, boundFn, promise, min = 10; | |
| var bind = function (fn, ctx, args){ | |
| boundFn = function (done){ | |
| done(fn.apply(ctx, args)); | |
| }; | |
| }; | |
| var reset = function (){ promise = null; }; | 
| "use strict"; | |
| import React from "react"; | |
| import rebound from "rebound"; | |
| const springSystem = new rebound.SpringSystem(); | |
| const SpringGroup = React.createClass({ | |
| getDefaultProps (){ | |
| return { | 
| ; TODO: infix syntax? | |
| ; Not everything is a set, but assignment is implicitly to a set. | |
| (def foo 1) | |
| ; equivalent to | |
| (def foo (Set 1)) | |
| (def foo 1 2) | |
| ; equivalent to | |
| (def foo (Set 1 2)) | 
ES2015, The newest iteration of JavaScript, introduces a ton of new features, types, and syntactic sugar. Those have all been explored pretty thoroughly, but the one that has the greatest implications for JavaScript are iterators; not the construct in itself but the use of the Iterator protocol.
Iterators are made possible by two new features: symbols and generators. Iterators are not necessarily a feature on their own, but rather a set of conventions around symbols and generators:
Given that JavaScript does not have interfaces, Iterable is more of a convention:
Source: A value is considered iterable if it has a method whose key is the symbol
Symbol.iteratorthat returns a so-called iterator. The iterator is an object that returns values via its methodnext(). We say: it enumerates items, one per method call.
| // stackify - take function with (a... -> [b]) signature | |
| // return unused stack with results on top | |
| function S (fn) { | |
| return function* (...args) { | |
| let iter = this; | |
| let ln = fn.length - args.length; | |
| yield* fn.apply(null,args.concat(takeMutable(iter,ln))) | |
| yield* iter | |
| } | |
| } |