This file contains 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
'use strict'; | |
var net = require('net'); | |
var db = Object.create(null); | |
net.createServer(function(socket) { | |
function sendError(err) { | |
console.error(err); | |
socket.write("-ERR " + err + "\r\n") | |
} |
This file contains 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
// Try with `redis-benchmark -t GET,SET -n 100000` | |
'use strict'; | |
var net = require('net'); | |
var split = require('split'); | |
var db = {}; | |
net.createServer(function(socket) { | |
function sendError(err) { | |
console.error(err); |
This file contains 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
/** | |
* Circular Tooltip (SO) | |
* http://stackoverflow.com/q/13132864/1397351 | |
*/ | |
* { margin: 0; padding: 0; } | |
body { | |
overflow: hidden; | |
background: url(http://theearlcarlson.com/experiments/amTooltip/img/bg.jpg); | |
} | |
/* generic styles for button & circular menu */ |
This file contains 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
function firstUnrepeated(str) { | |
var blacklist = []; | |
var once = {}; | |
str.split("").forEach(function(e, pos) { | |
if (blacklist.indexOf(e) === -1) { | |
once[e] = pos; | |
blacklist.push(e); | |
} | |
else { delete once[e]; } | |
}); |
This file contains 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 ( | |
"fmt" | |
) | |
type Stack struct { | |
top *Element | |
size int | |
} |
This file contains 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
macro val { | |
case $var:ident = $expr => { | |
var $var = $expr | |
} | |
case $var:ident = $x:lit .. $y:lit => { | |
var $var = (function() { | |
var arr = [] | |
for (var i = $x; i < $y; i++) | |
arr.push(i) |
This file contains 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
Function.prototype.runOnBackgroundThread = function (aCallback) { | |
var _blob = new Blob(['onmessage = '+this.toString()],{"type":"text/javascript"}); | |
var _worker = new Worker((webkitURL.createObjectURL || URL.createObjectURL)(_blob)); | |
_worker.onmessage = aCallback; | |
_worker.postMessage(); | |
} | |
var _test = function () { | |
postMessage((1+1).toString()); | |
} |
This file contains 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 __reduce= function (func, list, initial) { | |
if (initial != null) { | |
var value = initial; | |
var idx = 0; | |
} else if (list) { | |
var value = list[0]; | |
var idx = 1; | |
} else { | |
return null; | |
} |
This file contains 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
function HugeAnimal(name) { | |
Animal.apply(this, arguments) | |
} | |
HugeAnimal.prototype = new Animal | |
HugeAnimal.prototype.constructor = HugeAnimal | |
HugeAnimal.prototype.toString = function() { | |
return 'im ' + this.name + ' a ******* huge animal' | |
} |
This file contains 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
From ebb10691764938adec189da0e9f73e03a4291b2c Mon Sep 17 00:00:00 2001 | |
From: Sergi Mansilla <[email protected]> | |
Date: Wed, 14 Sep 2011 14:35:50 +0200 | |
Subject: [PATCH] Small optimizations | |
--- | |
jsftp.js | 22 +++++++++++++++------- | |
1 files changed, 15 insertions(+), 7 deletions(-) | |
diff --git a/jsftp.js b/jsftp.js |