git clone git://gist.github.com/923934.git redisearch
cd redisearch
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 doHash(str, seed) { | |
var m = 0x5bd1e995; | |
var r = 24; | |
var h = seed ^ str.length; | |
var length = str.length; | |
var currentIndex = 0; | |
while (length >= 4) { | |
var k = UInt32(str, currentIndex); | |
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
Array.prototype.intersect = function(b) { | |
return this.filter(function(n) { | |
return (b.indexOf(n) != -1); | |
}); | |
} | |
Array.prototype.diff = function(a) { | |
return this.filter(function(n) { | |
return !(a.indexOf(n) > -1); | |
}); |
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
(ns neural-net.core) ; Copyright Eric Schulte, GPL V3 | |
(defprotocol Neural | |
"Protocol implemented by any element of a neural network." | |
(run [this x] "Evaluates the net") | |
(train [this x y d] "Trains the net returning the updated net and deltas") | |
(collect [this key] "Collect key from the network") | |
(inputs [this] "Number of inputs") | |
(outputs [this] "Number of outputs") | |
(check [this] "Ensure that the number of inputs matches the outputs")) |
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() { | |
this.tmpl3 = function tmpl(str, data) { | |
var value = "var out = ''; out+=" + "'" + | |
str.replace(/[\r\t\n]/g, " ") | |
.replace(/'(?=[^%]*%>)/g,"\t") | |
.split("'").join("\\'") | |
.split("\t").join("'") | |
.replace(/<%=(.+?)%>/g, "'; out += $1; out += '") | |
.split("<%").join("';") |
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
Browse: | |
https://oauth.twitter.com/2/authorize?oauth_callback_url=http://www.example.com/&oauth_mode=flow_web_client&oauth_client_identifier=7ynojZQ3uVE2DifWftbS3w | |
After authentication, user gets redirected to: | |
http://www.example.com/#oauth_access_token=RnEJAQAAAABpYH8NAAAAAGKSBQAAAAAAr9G2hLrnXaznri8LlSIaR0HuNBI=HLx1r47oqpobPncAm9DNeRCdySaMqoTKJcCLwnhIP&oauth_bridge_code=2wxWDd3IIZ0UW1y4oFpioWfbzTeaAlSGoJk5L6qMpGQ | |
...Use the API: |
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( d ) { | |
// Create a copy of this date object | |
var target = new Date(d.valueOf()); | |
// ISO week date weeks start on monday | |
// so correct the day number | |
var dayNr = (d.getDay() + 6) % 7; | |
// Set the target to the thursday of this week so the |
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
<canvas id="MyCanvas" width="300" height="300"> | |
</canvas> | |
<img id="MyImg"/> | |
<script> | |
function drawAndConvertStuff(canvas) { | |
var canvasContext = canvas.getContext('2d'); | |
//draw a black box |
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
/**********************************************/ | |
/* | |
/* Solarized Dark Skin by Mark Osborne - 2011 | |
/* | |
/* Based on IR_Black Skin by Ben Truyman: | |
/* https://gist.github.com/1245727 | |
/* | |
/* and Todd Werth's IR_Black: | |
/* http://blog.toddwerth.com/entries/2 | |
/* |
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
// Here is a proposal for minimalist JavaScript classes, humbly offered. | |
// There are (at least) two different directions in which classes can be steered. | |
// If we go for a wholly new semantics and implementation, then fancier classical | |
// inheritance can be supported with parallel prototype chains for true inheritance | |
// of properties at both the class and instance level. | |
// If however, we keep current JavaScript prototype semantics, and add a form that | |
// can desugar to ES3, things must necessarily stay simpler. This is the direction | |
// I'm assuming here. |
OlderNewer