This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BLOCKSIZE = 500; | |
var dataset = []; // Assuming, of course, that there's something in here.. | |
var renderActions = []; | |
for (var i=0; i<dataset.length; i+= BLOCKSIZE) { | |
renderActions.push((function(offset) { | |
return function(callback) { | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sequencer = function(lambdas) { | |
var self = this; | |
this.start = function() { | |
this.next(); | |
} | |
this.next = function() { | |
if (lambdas.length != 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Example #1 : sequence 10000 async calls | |
// | |
function sequence(arr) { | |
var self = function() { | |
arr.length && arr.shift()(self); | |
} | |
self(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Example #2 : sequence 10000 async calls in blocks of 500 using a collector | |
// | |
function sequence(arr) { | |
var self = function() { | |
arr.length && arr.shift()(self); | |
} | |
self(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Example #3 : sequence 10000 async calls in a pipeline, with max 500 open | |
// | |
function pipeline(arr, maxOpenCalls, finalCallback) { | |
var openCalls = 0; | |
function callback() { | |
if (--openCalls < maxOpenCalls) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sequence = (arr) -> | |
self = -> | |
if arr.length then arr.shift() self | |
self() | |
async = (callback) -> | |
console.log "Calling callback after 1s" | |
setTimeout callback, 1000 | |
sequence [async, async, async] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Wide-open CORS config for nginx | |
# | |
location / { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Ex. sort on attrs = [ | |
// ["Name", "asc"], | |
// ["Description, "desc"] | |
// ] | |
// | |
// This is how we do just one column, | |
// | |
// function sortOn(objs, attr, order) { | |
// return objs.sort( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sort = (objs, attrs) -> | |
dojo.map( | |
(dojo.map objs, (obj) -> | |
arr = [obj] | |
dojo.forEach attrs, (attr) -> | |
arr.push obj.get(attr) | |
arr | |
).sort( | |
(attrsA, attrsB) -> | |
i = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"io" | |
"os" | |
"crypto/tls" | |
"strings" | |
"net" | |
"flag" |
OlderNewer