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 util = require("util"); | |
var A =function() { | |
// constructor | |
} | |
A.prototype.on = function() { | |
console.log('Call A: ON'); | |
}; |
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
walk(process.env.HOME, function(err, results) { | |
if (err) throw err; | |
console.log(results); | |
}); |
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
<script type="text/javascript"> | |
/* CSS to JS style detector */ | |
document.getElementsByTagName("html")[0].className = document.getElementsByTagName("html")[0].className.replace( /(?:^|\s)no\-js(?!\S)/ , '' ) | |
</script> |
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
#include <v8.h> | |
#include <node.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
using namespace node; | |
using namespace v8; | |
struct Test_req | |
{ |
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
/** | |
* Small regular expression to match ASCII-chars between 32-126 | |
* | |
* For a conversion table for ASCII chars see: | |
* http://de.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange | |
*/ | |
var expr = /([\x20-\x7E]{1,})/gi; | |
var testString = "Foo Bar Barz"; | |
var testString2 = "Foo Bar\tBarz"; |
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
/** | |
* hasKeyExists | |
* | |
* Searches for a hierarchical combination of keys in a json object | |
* | |
* @{Object} JSON Object | |
* @{String} path seperated with "." for example level1.level2.foo | |
* @return {Boolean} | |
*/ | |
var hashKeyExists = function(obj,path){ |
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 a = { a: { b: 1 } }; | |
var b = ['a','b']; | |
var hashKeyExists = function(obj,path){ | |
var keys = path.split('.'); | |
var keyExists = function(obj,keyList){ | |
var cur = keyList.shift(); |
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
for t in $(mysql --batch --column-names=false -e "show tables" dbname |grep -v "exclude_this"); | |
do | |
mysql -e "alter table $t engine=InnoDB" dbname; | |
done |
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
#include <v8.h> | |
#include <node.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
using namespace node; | |
using namespace v8; | |
struct Test_req | |
{ |
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
#define ASYNC_CALL(func, callback, ...) \ | |
FSReqWrap* req_wrap = new FSReqWrap(); \ | |
int r = uv_fs_##func(uv_default_loop(), &req_wrap->req_, \ | |
__VA_ARGS__, After); \ | |
assert(r == 0); \ | |
req_wrap->object_->Set(oncomplete_sym, callback); \ | |
req_wrap->Dispatched(); \ | |
return scope.Close(req_wrap->object_); |