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
// All variables MUST be initially declared using a keyword. | |
// Let's use "var" | |
var g = "global" | |
h = "bad" // ReferenceError, cannot find undeclared variable "h" | |
foo() { | |
var b; | |
console.log(a) // ReferenceError, cannot find undeclared variable "a" | |
console.log(b) // "nil", undeclared variables default to nil (since candor doesn't do undefined right?) |
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 $p = require('procstreams'); | |
// this is the one I'm leaning towards. simple and intuitive | |
// cd is a special chain function that changes dir | |
// and keeps state for subsequent proc chains | |
$p.cd('tests') | |
.and('cat test-simple.js') | |
.pipe('grep data') | |
.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
// From benchmark.js - https://github.com/bestiejs/benchmark.js/blob/33aca33e4986386d782bbc7c2ab85cf34ed90bd2/benchmark.js | |
/** | |
* A deep clone utility. | |
* @static | |
* @memberOf Benchmark | |
* @param {Mixed} value The value to clone. | |
* @returns {Mixed} The cloned value. | |
*/ | |
function deepClone(value) { | |
var accessor, |
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
exports.somethingAsync = function(callback) { | |
setTimeout(function() { | |
callback(null "done"); | |
}, 100); | |
} | |
exports.failingAsync = function(callback) { | |
setTimeout(function() { | |
callback(new Error("failed")); | |
}, 100); |
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 fs = require('fs') | |
var DataCollector = function(arr) { | |
this.setFiles(arr) | |
} | |
DataCollector.prototype = { | |
setFiles: function(arr) { | |
this.files = arr | |
} |
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
/** | |
* hex2rgb - function for converting hex colors to rgb(a) | |
* | |
* Shout out to http://hex2rgba.devoth.com/ | |
* | |
* @hex (String) - The hex value. Can be prefixed with "#" or not. Can be | |
* long format (6 chars) or short format (3 chars) | |
* @opacity (number between 0 and 1) - This is an optional float value that | |
* will be used for the opacity | |
* |
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
{ | |
"color_scheme": "Packages/Color Scheme - Default/Blackboard.tmTheme" | |
, "fold_buttons": false | |
, "font_size": 16.0 | |
, "tab_size": 4 | |
, "word_wrap": true | |
, "rulers": [72] | |
, "translate_tabs_to_spaces": true | |
, "wrap_width": 72 | |
, "draw_white_space": "all" |
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
// FAILS=0 | |
// for i in tests/test-*.js; do | |
// echo $i | |
// node $i || let FAILS++ | |
// done | |
// exit $FAILS | |
var fs = require('fs') | |
, glob = require('glob') | |
, $p = require(__dirname + '/..'); |
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
diff --git a/node/handler/APIHandler.js b/node/handler/APIHandler.js | |
index a057bfc..7476818 100644 | |
--- a/node/handler/APIHandler.js | |
+++ b/node/handler/APIHandler.js | |
@@ -75,8 +75,8 @@ exports.handle = function(functionName, fields, req, res) | |
//check the api key! | |
if(fields["apikey"] != apikey) | |
{ | |
- res.send({code: 4, message: "no or wrong API Key", data: null}); | |
- return; |
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 log4js = require('log4js') | |
, lsyslog = require('log4js-syslog') | |
//, syslog = require('node-syslog') | |
log4js.addAppender(lsyslog.appender(), 'syslog'); | |
//syslog.init("node-syslog", syslog.LOG_PID | syslog.LOG_CONS, syslog.LOG_USER); | |
var logger = log4js.getLogger('syslog'); | |
setInterval(function() { |