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
var fs = require('fs'); | |
var exec = require('child_process').exec, child; | |
// Inputs | |
var inputDir = './developer/test/unit/data/input/'; | |
var expectedDir = './developer/test/unit/data/expected/'; | |
var outputDir = './developer/test/unit/data/output/'; | |
var parserA = './server/load-it/logax-a-parser.js'; | |
var parserB = './server/load-it/logax-b-parser.js'; | |
var inputFiles = new Array(3); |
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
/** | |
* @method | |
* @public | |
* @description Take an array of objects and convert to an array of pairs whose | |
* xCol are grouped and yCol values are aggregated somehow. If | |
* grouping by day or month, dates must be in ZULU format strings! | |
* Original implementation returned an object with keys = xCol and | |
* values = yCol. It worked great but js maps(objects) cannot be | |
* sorted! | |
* @param {array} |
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
var ngGridObj = [ { | |
"entity" : { | |
'date' : '2013-09-23 23:23:23', | |
'amt' : 4.5, | |
'name' : 'Mike' | |
} | |
}, { | |
"entity" : { | |
'date' : '2013-09-26 23:23:23', | |
'amt' : 6.5, |
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 util = require( "util" ); | |
// Create a linked-list and reverse it. | |
// This is just a rough bit of code to solve the problem. | |
// If I had more time I would maybe try a different algorithm | |
// where I switch the pointer as I walk to the end. | |
// Also I may change the members to be private. | |
util.puts( "Make a list and print it out!" ); |
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 _ = require('underscore'); | |
fs.readFile('area.json',function(err,data) { | |
var a = JSON.parse(data); | |
console.log(a.length); | |
var b = _.map(a,function(row) { | |
var o = new Object(); | |
o.area = row.at4; |
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 a = require( "./tree" ); | |
/* | |
* 1A | |
* 2A 2B 2C | |
* 3A 3B 3C | |
* 4A 4B 4C | |
* 5A |
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 util = require('util'); | |
util.puts("Convert tree to query!"); | |
var tree = { | |
type : "and", | |
left : { | |
type : "eq", | |
left : { | |
type : "property", | |
name : "City" |
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 | |
/*========================================================= | |
Break up a string of words with no spaces into a string of words with appropriate spaces. | |
=========================================================*/ | |
var dictionary = { | |
'the' : 0, | |
'a' : 0, | |
'may' : 0, |
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 util = require("util"); | |
util.puts("Search Array for value N."); | |
// This only took me 12 minutes to do on a white board. | |
// This has a complexity of O(log n). | |
// 0 1 2 3 4 5 6 7 8 9 10 11 | |
var a = [ 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16 ]; | |
var _indexOf = function(pos1, pos2, n) { |
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 | |
/* | |
* Design a stack with a push, pop, and min method. | |
* Min returns the smallest element. | |
* All methods must operate in O(1) time. | |
* I implemented this with simple numbers, but I could enhance it | |
* to use objects with a comparator function. | |
*/ |
OlderNewer