Recent releases have been pre-built using cross-compilers and this script and are downloadable below.
If you have found these packages useful, give me a shout out on twitter: @adammw
function eachAsync(collection, iterator, callback) { | |
var iterate = function(i) { | |
setTimeout(function() { | |
iterator(collection[i]); | |
if (i < collection.length) { | |
iterate(i + 1); | |
} else { | |
callback(); | |
} | |
}, 0); |
var now = (function() { | |
// Returns the number of milliseconds elapsed since either the browser navigationStart event or | |
// the UNIX epoch, depending on availability. | |
// Where the browser supports 'performance' we use that as it is more accurate (microsoeconds | |
// will be returned in the fractional part) and more reliable as it does not rely on the system time. | |
// Where 'performance' is not available, we will fall back to Date().getTime(). | |
// jsFiddle: http://jsfiddle.net/davidwaterston/xCXvJ |
// do not use result cache, nor line and column tracking | |
{ var indentStack = [], indent = ""; } | |
start | |
= INDENT? lines:( blank / line )* | |
{ return lines; } | |
line | |
= SAMEDENT line:(!EOL c:. { return c; })+ EOL? |
Recent releases have been pre-built using cross-compilers and this script and are downloadable below.
If you have found these packages useful, give me a shout out on twitter: @adammw
//------------------------------------------------------------- | |
// | |
// Hypothesis: | |
// | |
// Promises/A is a Monad | |
// | |
// To be a Monad, it must provide at least: | |
// - A unit (aka return or mreturn) operation that creates a corresponding | |
// monadic value from a non-monadic value. | |
// - A bind operation that applies a function to a monadic value |
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
// shamlessly stolen from lodash | |
/*global define:false*/ | |
;(function( window, undefined ) { | |
var freeExports = false; | |
if ( typeof exports === 'object' ) { | |
freeExports = exports; | |
if ( exports && typeof global === 'object' && global && global === global.global ) { window = global; } | |
} |
macro $do { | |
case { $y:expr } => { | |
$y | |
} | |
case { $x:ident <- $y:expr $rest ... } => { | |
λ['>=']($y, function($x) { | |
return $do { $rest ... } | |
}); | |
} | |
} |
macro sexp { | |
case () => { | |
; | |
} | |
case ($p) => { | |
$p | |
} | |
case ($x $y) => { | |
$x($y); | |
} |
// Note: there are bugs in hygienic renaming, so this doesn't work all the time yet. | |
macro varr { | |
case [$var (,) ...] = $expr => { | |
var i = 0; | |
var arr = $expr; | |
$(var $var = arr[i++];) ... | |
} |