This file contains hidden or 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
// C++11 scoped timer class and usage | |
// | |
// an example of RAII 'resource acquisition is initialisation' idiom | |
// build : g++ -Wall -std=c++11 -O5 -o scoped_timer scoped_timer.cpp | |
// | |
// on linux x64 resolution of timer seems to be microseconds [ on win/VC it may be much worse ] | |
// | |
// I like this approach as it doesnt litter your existing code with garbage, | |
// although there might be some inaccuracy due to stack setup/pulldown of the timer class itself | |
// |
This file contains hidden or 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/env node | |
var fs = require('fs'); | |
var jsonpath = require('JSONPath'); | |
if (process.argv.length<3) | |
{ | |
console.log('usage: jsonpath json_filename json_path_expr'); | |
exit; |
This file contains hidden or 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
exports.SerialQueue = function() | |
{ | |
var sq = | |
{ | |
funcs : [], | |
next : function() | |
{ | |
var Q = this; | |
var f = Q.funcs.shift(); | |
if (f) |