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 TSN = require('TSN'); | |
var fs = require("fs"); | |
var template = TSN.load('template.xml'); | |
var file = fs.createWriteStream('template.html', { | |
flags: 'a', | |
encoding: 'utf-8', | |
mode: 0666 | |
}); |
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
/* | |
* Range | |
* @author: Alexander Guinness | |
* @version: 1.0 | |
* @license: MIT | |
* @date: 7/20/12 9:28 PM | |
*/ | |
function range (from, to, step) { | |
var array = []; |
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
/** | |
* rating stars | |
*/ | |
.rating { | |
height: 18px; | |
width: 82px; | |
} | |
.rating_star { |
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
/* | |
Object.setPrototypeOf is not going to happen. Writable __proto__ | |
is a giant pain to implement (must serialize to cycle-check) | |
and it creates all sorts of type-confusion hazards (Brendan Eich). | |
*/ | |
Object.setPrototypeOf = function (object, proto) { | |
var __proto__ = proto; | |
do { |
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
/** | |
* Object.deepFreeze | |
* Licensed under the MIT | |
* @author: Alexander Guinness | |
* @version: 1.1 | |
* @date: Fri Jun 27 17:26:00 2011 | |
**/ | |
if (!Object.deepFreeze && Object.freeze && Object.isFrozen) { | |
Object.deepFreeze = function(object) |
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
/* | |
* DOM Level 2 Events: handleEvent | |
* @author Alexander Guinnes, Thomas Aylott (original author) | |
* @description http://ajaxian.com/archives/an-alternative-way-to-addeventlistener | |
**/ | |
function EventListener(element, phase) | |
{ | |
var listener = { | |
addEvent: function (type, callback) |
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
#include "objc_id.hpp" | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
NSString *s1 = @"hello"; | |
NSString *s2 = [@"hell" stringByAppendingString: @"o"]; | |
if ((objc_id(s1) == objc_id(s2))) { | |
NSLog(@"win"); |
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
/* extend | |
* | |
* @param {object} from | |
* @param {object} to | |
* @param {Array} [ array ] - array of properties | |
* | |
* using: | |
* extend(object_1, object_2); // clone object | |
* extend(object_1, object_2, ['foo', 'bar']); // take some properties |
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
~/src/cppcms-1.0.1/build$ make | |
[ 0%] Building CXX object booster/CMakeFiles/booster.dir/lib/ptime/src/posix_time.cpp.o | |
[ 0%] Building CXX object booster/CMakeFiles/booster.dir/lib/ptime/src/ctime.cpp.o | |
[ 1%] Building CXX object booster/CMakeFiles/booster.dir/lib/regex/src/pcre_regex.cpp.o | |
[ 1%] Building CXX object booster/CMakeFiles/booster.dir/lib/system/src/posix_error.cpp.o | |
[ 1%] Building CXX object booster/CMakeFiles/booster.dir/lib/system/src/windows_error.cpp.o | |
[ 2%] Building CXX object booster/CMakeFiles/booster.dir/lib/aio/src/aio_category.cpp.o | |
[ 2%] Building CXX object booster/CMakeFiles/booster.dir/lib/aio/src/deadline_timer.cpp.o | |
[ 2%] Building CXX object booster/CMakeFiles/booster.dir/lib/aio/src/endpoint.cpp.o | |
[ 3%] Building CXX object booster/CMakeFiles/booster.dir/lib/aio/src/io_service.cpp.o |
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
### range | |
python -m timeit -c 'for x in range(100): pass' | |
#100000 loops, best of 3: 3.17 usec per loop | |
python -m timeit -c 'for x in range(10000): pass' | |
1000 loops, best of 3: 314 usec per loop | |
### xrange |
OlderNewer