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
| macro_rules! v8_try { | |
| ($expr:expr, $args:ident) => ({ | |
| let ret; | |
| match $expr { | |
| Ok(val) => { | |
| ret = Some(val); | |
| }, | |
| Err(err) => { | |
| ret = None; | |
| $args.GetReturnValue().SetWithBool(false) |
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 tls = require('tls'); | |
| var start = Date.now(); | |
| function connect() { | |
| tls.connect({host:'imap.gmail.com', port:993} , function() { | |
| console.log('connected', Date.now() - start); | |
| }); | |
| } | |
| var max = 50 |
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
| test: | |
| ifneq ($(module),) | |
| mocha /path/to/your/tests/$(module).js | |
| else | |
| mocha /path/to/your/tests/*.js |
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
| function parseQuerystring (key) { | |
| var href = location.href; | |
| var start = href.indexOf('?'); | |
| var obj = href.slice(start+1).split('&'); | |
| var ret = {}; | |
| obj.forEach(function (item) { | |
| var vals = item.split('='); | |
| var key = vals[0]; | |
| var val = decodeURI(vals[1]).replace(/\+/g, ' '); | |
| ret[key] = val; |
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
| txtblk='\e[0;30m' # Black - Regular | |
| txtred='\e[0;31m' # Red | |
| txtgrn='\e[0;32m' # Green | |
| txtylw='\e[0;33m' # Yellow | |
| txtblu='\e[0;34m' # Blue | |
| txtpur='\e[0;35m' # Purple | |
| txtcyn='\e[0;36m' # Cyan | |
| txtwht='\e[0;37m' # White | |
| bldblk='\e[1;30m' # Black - Bold | |
| bldred='\e[1;31m' # Red |
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 multiline = function (f) { | |
| return f.toString().split('\n').slice(1, -1).join('\n'); | |
| }; | |
| var data = multiline(function() {/* | |
| <html> | |
| <body> | |
| <h1>Hello, Parallel World</h1> | |
| </body> | |
| </html> |
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
| import Data.Char | |
| -- toUpperCase() -- | |
| map isUpper "abcDEF" | |
| -- compute the number of containing lower/upper chars -- | |
| length (filter isLower "xxxXXXX") | |
| -- will return 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
| openssl genrsa 1024 > key.pem | |
| openssl req -x509 -new -key key.pem > cert.pem |
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
| ssh-keygen -t rsa -C "[email protected]" | |
| eval "$(ssh-agent -s)" | |
| ssh-add ~/.ssh/id_rsa | |
| pbcopy < ~/.ssh/id_rsa.pub |
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
| pgclient.connect(function () { | |
| pgclient.query('select distinct user_id, gender from users where gender == NULL', function (err, resukt) { | |
| console.log(result.rows); // [] | |
| }); | |
| pgclient.query('select distinct user_id, gender from users where gender is NULL', function (err, result) { | |
| console.log(result.rows); // [...] | |
| }); | |
| }); |
NewerOlder