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
#!/bin/sh | |
if [ ! -n "$1" ]; then | |
echo "Usage: $0 'debug' | 'release'" | |
exit 0 | |
fi | |
MODE=$1 | |
OUT_DIR=./out-$MODE | |
DEBUG="false" | |
if [ "$MODE" == "debug" ]; then |
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
Also not that `a + "a"` is "3a" (and "a3" the other way around) | |
I'm pretty certain it's because `typeof a === "object"` and `typeof "a" === "string"`. | |
The `+` operator calls `toPrimitive` on each operand, but since the literal strings | |
are already primitives, no further action is taken. It's only when they are | |
objects that it delegates to `[[DefaultValue]]` which ends up calling its `valueOf` method. |
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
// LazyLoad, modified to be a loadrunner module | |
provide(function(exports) { | |
/*jslint browser: true, eqeqeq: true, bitwise: true, newcap: true, immed: true, regexp: false */ | |
/** | |
LazyLoad makes it easy and painless to lazily load one or more external | |
JavaScript or CSS files on demand either during or after the rendering of a web | |
page. | |
Supported browsers include Firefox 2+, IE6+, Safari 3+ (including Mobile |
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 grep = function(o, n) { | |
var s = ""; | |
if (typeof o === "string") { | |
n = o; | |
o = window; | |
s = "window" | |
} | |
function actualGrep(o, n, s) { | |
Object.keys(o).forEach(function(k) { |
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
// adaptive function for the new string IDs for Twitter API objects (Snowflake) | |
function useStringIdentifier(obj, property) { | |
var property_str = property + "_str"; | |
if (!obj) { | |
return; | |
} | |
if (obj[property_str]) { | |
obj[property] = obj[property_str].toString(); | |
delete obj[property_str]; |
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
/* | |
natcompare.js -- Perform 'natural order' comparisons of strings in JavaScript. | |
Copyright (C) 2005 by SCK-CEN (Belgian Nucleair Research Centre) | |
Written by Kristof Coomans <kristof[dot]coomans[at]sckcen[dot]be> | |
Based on the Java version by Pierre-Luc Paour, of which this is more or less a straight conversion. | |
Copyright (C) 2003 by Pierre-Luc Paour <[email protected]> | |
The Java version was based on the C version by Martin Pool. | |
Copyright (C) 2000 by Martin Pool <[email protected]> |
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
class JsObject(object): | |
def __init__(self, *args, **kwargs): | |
for arg in args: | |
self.__dict__.update(arg) | |
self.__dict__.update(kwargs) | |
def __getitem__(self, name): | |
return self.__dict__.get(name, None) | |
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 foo, bar; | |
foo = function () { | |
bar(); | |
} | |
bar = function () { | |
foo(); | |
} |
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
// Simple arithemetic parser. | |
// Follows order of operations, only supports positive integers | |
// Only operators are +, -, *, and /. Does not support grouping with () | |
var calc = (function () { | |
var calc, | |
sum, | |
negasum, | |
product, | |
dividend; | |
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 performance = (function () { | |
var my = {}; | |
// Wrap a function body in this to return a copy that instruments itself | |
// If you want this to be useful, you should give your profiled function a name, | |
// otherwise it will be identified as "", which is less than useful. | |
my.profile = function (func) { | |
return function () { | |
var start = new Date().getTime(), | |
time, |
NewerOlder