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
/* | |
* Copyright (c) 2010 Tobias Schneider | |
* This script is freely distributable under the terms of the MIT license. | |
*/ | |
(function(){ | |
var UPC_SET = { | |
"3211": '0', | |
"2221": '1', | |
"2122": '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
/* | |
Render SVG Arc with canvas commands | |
Usage: solveArc(x, y, coords) | |
*/ | |
function solveArc(x, y, coords) { | |
var rx = coords[0] | |
var ry = coords[1] | |
var rot = coords[2] | |
var large = coords[3] |
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
// http://mrl.nyu.edu/~perlin/noise/ | |
var ImprovedNoise = function () { | |
var p = [151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10, | |
23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87, | |
174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211, | |
133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208, | |
89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5, | |
202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119, |
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
window._gzip = (function() | |
{ | |
var _matchCount = function(s, word) | |
{ | |
var n = 0, wordLen = word.length, p = -wordLen; | |
while((p = s.indexOf(word, p + wordLen)) > -1) | |
++n; | |
return 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
#!/usr/bin/python2.4 | |
import httplib, urllib, sys | |
# ('code_url', sys.argv[1]) if we wanted to actually pass in a value from command line -> say u wanted to compress a different file... | |
params = urllib.urlencode([ | |
('code_url', 'http://github.com/getify/LABjs/raw/master/LAB.src.js'), | |
('compilation_level', 'SIMPLE_OPTIMIZATIONS'), | |
('output_format', 'text'), | |
('output_info', 'compiled_code'), |
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
/*! | |
* isSemVer - v0.1 - 9/05/2010 | |
* http://benalman.com/ | |
* http://semver.org/ | |
* | |
* Copyright (c) 2010 "Cowboy" Ben Alman | |
* Dual licensed under the MIT and GPL licenses. | |
* http://benalman.com/about/license/ | |
*/ |
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
// 1: how could you rewrite the following to make it shorter? | |
if (foo) { | |
bar.doSomething(el); | |
} else { | |
bar.doSomethingElse(el); | |
} | |
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
HDCP MASTER KEY (MIRROR THIS TEXT!) | |
This is a forty times forty element matrix of fifty-six bit | |
hexadecimal numbers. | |
To generate a source key, take a forty-bit number that (in | |
binary) consists of twenty ones and twenty zeroes; this is | |
the source KSV. Add together those twenty rows of the matrix | |
that correspond to the ones in the KSV (with the lowest bit | |
in the KSV corresponding to the first row), taking all elements |
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
// See my blog post: | |
// http://benalman.com/news/2010/09/partial-application-in-javascript/ | |
// In the following code sample, invoking the curried function will always | |
// return a function until all arguments are satisfied, at which point the | |
// original function is invoked, returning its result. This means that all | |
// function arguments are required, which also allows the function to be | |
// called either like foo( 1, 2, 3 ) or foo( 1 )( 2 )( 3 ). This also means | |
// that if any argument is omitted, the original function is never invoked. |
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 express = require('express'), | |
request = require('request'), | |
BufferList = require('bufferlist').BufferList, | |
sys = require('sys'); | |
var app = express.createServer( | |
express.logger(), | |
express.bodyDecoder() | |
); |
OlderNewer