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
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl http://npmjs.org/install.sh | sh |
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 http = require('http'); | |
| var fs = require('fs'); | |
| var ip = '127.0.0.1'; | |
| var port = 2000; | |
| var www = process.cwd(); | |
| var mimetypes = {'html': 'text/html', 'js': 'text/javascript', 'css': 'text/css', 'png': 'image/png', 'svg': 'image/svg'}; | |
| var path = require('path'); | |
| http.createServer(function (req, res) { | |
| fs.realpath(path.join(www, req.url), function(err, realpath){ |
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 http = require('http') | |
| , director = require('director') | |
| , PORT = process.env.port || 8000 | |
| var routes = { | |
| '/hello': { | |
| get: function(route) { this.res.end('/hello') } | |
| } | |
| } | |
| var routerOptions = { notfound: notFound } |
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 Animal() { | |
| this.legs = 4; | |
| }; | |
| function Dog() { | |
| this.sound = 'woof'; | |
| }; | |
| Dog.prototype = new Animal(); | |
| function Cat() { |
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
| /* | |
| # set a password, leave all else as default | |
| echo "requirepass password" >> tests/auth_error.conf | |
| # start redis server | |
| redis-server tests/auth_error.conf | |
| # run this script | |
| node tests/auth_error.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
| # | |
| # add this to your ~/.bashrc | |
| # | |
| # start dropbox | |
| if [ "$(pidof dropbox)" ] | |
| then | |
| # dont start | |
| echo "dropbox is running" | |
| else |
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
| // | |
| // How would you prefer to use a mkdir-p API? | |
| // Note that this is for making directories in ZooKeeper :) | |
| // | |
| // | |
| // Option #1 | |
| // | |
| var mkdirp = require('zk-mkdirp'); |
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 redis = require("../index"); | |
| var async = require("async"); | |
| // Set this to truthy to see the wire protocol and other debugging info | |
| redis.debug_mode = process.argv[2]; | |
| client1 = redis.createClient(); | |
| client2 = redis.createClient(); | |
| multi1 = client1.multi(); |
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
| { | |
| "name": "my-big-json-package-example" | |
| , "description": "see `npm help json` for full docs. Thanks for reading! — @ddtrejo" | |
| , "keywords": [ "keywords", "to help people find", "this package" ] | |
| , "homepage": "http://npmjs.org/doc/json.html" | |
| , "bugs": { | |
| "//": "(either hash is optional)" | |
| , "url" : "http://github.com/isaacs/npm/issues" | |
| , "email" : "[email protected]" | |
| } |
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 redis = require('redis') | |
| , client = redis.createClient() | |
| , assert = require('assert'); | |
| // redis.debug_mode = true; | |
| client.on("error", function (err) { | |
| console.log("Error " + err); | |
| }); |