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
| // things you should be able to know from javascript, according to Dmitry Baranovskiy - http://www.youtube.com/watch?v=Trr95ij1358 | |
| 5 - "4"; | |
| 5 + "4"; | |
| +!{}[true] | |
| +[1] | |
| +[1,2] | |
| 7 - "a" | |
| 7 / 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
| var operands = "", operation = ""; for (var i = 0; i < 10; i++) { operands += "- + "; operation = '1 + ' + operands + '1'; console.log(operation + ": " + eval(operation) ); } | |
| /* | |
| 1 + - + 1: 0 | |
| 1 + - + - + 1: 2 | |
| 1 + - + - + - + 1: 0 | |
| 1 + - + - + - + - + 1: 2 | |
| 1 + - + - + - + - + - + 1: 0 | |
| 1 + - + - + - + - + - + - + 1: 2 | |
| 1 + - + - + - + - + - + - + - + 1: 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
| #!upstart | |
| description "node.js enhancement_renderer" | |
| author "john weis" | |
| start on startup | |
| stop on shutdown | |
| script | |
| export HOME="/root" |
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
| # Start an HTTP server from a directory, optionally specifying the port | |
| function server() { | |
| local port="${1:-8888}" | |
| open "http://localhost:${port}/" | |
| # Set the default Content-Type to `text/plain` instead of `application/octet-stream` | |
| # And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files) | |
| python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port" | |
| } |
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 test_pntdrrn_regex(pattern, sample, dividend, divisor) { | |
| console.log( | |
| dividend + "/" + divisor + "\t\t" + | |
| pattern.toString() + | |
| ( pattern.test(sample) ? "" : " doesn't" ) + " match" + | |
| ( pattern.test(sample) ? "es " : " " ) + | |
| "`" + sample + "`" | |
| ); | |
| } |
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
| mkdir -p ~/src && cd ~/src | |
| git clone git://github.com/joyent/node.git | |
| cd node | |
| ./configure | |
| make | |
| make install |
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 request = require('request'), | |
| u = require('underscore') | |
| exec = require('child_process').exec, | |
| child = null, | |
| repos = null; | |
| request('https://api.github.com/users/weisjohn/repos', function (error, response, body) { | |
| if (!error && response.statusCode == 200) { | |
| // grab all the repos from github |
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 SimpleHTTPServer; | |
| map = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map; | |
| map[""] = "text/plain" | |
| for key, value in map.items(): | |
| map[key] = value + ";charset=UTF-8" | |
| SimpleHTTPServer.test() |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset=utf-8 /> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <video id="sourcevid" autoplay="true">NO SUPPORT FOR VIDEO </video> | |
| </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
| # Description: | |
| # Use Skynet to determine if a thing that was said is actually something | |
| # S.H.E (Silicon Helix Entity) said. | |
| # | |
| # Dependencies: | |
| # "twss": "0.1.6" | |
| # | |
| # Commands: | |
| # Just say something like, "that was hard". Hubot will do the rest. | |
| # |