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 foo = require("foo"), | |
| bar = foo.bar; | |
| exports.bar = bar; |
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
| #!/bin/bash | |
| NODE_VERSION=0.4.10 | |
| NODE_FILE=node-v$NODE_VERSION | |
| apt-get -y update | |
| apt-get install -y aptitude | |
| aptitude install -y unattended-upgrades build-essential libssl-dev libexpat1-dev pkg-config git-core nginx | |
| wget http://nodejs.org/dist/$NODE_FILE.tar.gz | |
| tar -zxvf $NODE_FILE.tar.gz | |
| pushd $NODE_FILE; ./configure && make; make install; popd | |
| rm -rf $NODE_FILE.tar.gz $NODE_FILE |
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
| Seq = require("seq") | |
| Seq() | |
| .seq_ (next) => | |
| fs.readFile(__filename, next); | |
| .seq_ (next, text) => | |
| this.ok text.toUpperCase(); | |
| .seq_ (next, newText) => | |
| console.log(newText); | |
| .catch (err) => |
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
| web: node server.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
| { | |
| "name": "private-module-name", | |
| "version": "0.0.1", | |
| "private": true | |
| } |
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
| npm install express |
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
| /* | |
| The below two objects are nearly identical. They both demonstrate inheritance | |
| The top one is using klass by Dustin Diaz | |
| The bottom one is using an extraction of Prototype's class method | |
| Their pros and cons are listed with their executions | |
| BOTH PROS | |
| * Support super() through their own means | |
| * can add additional methods via .implements (klass) and addMethods (pt) | |
| BOTH CONS |
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() { | |
| $.getScript("http://platform.linkedin.com/in.js?async=true", function success() { | |
| IN.init({ | |
| api_key: "<your api key>" | |
| }); | |
| }); | |
| }); |
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
| /* | |
| JavaScript CSS will change the way developers write CSS for their nodejs | |
| applications. In apps like express, you're already stepping away from | |
| HTML / CSS with SASS and LESS, so why not keep everything to a single language? | |
| JSSS allows you to write CSS using chained methods familiar to JavaScript | |
| developers. The CSS will then be optimized and written to the page (in browser). | |
| Server side, the most optimal configuration for your stylesheet will be | |
| determined, and rendered using epic awesome nodejs power and the help of a Ninja | |
| Turtle. |
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
| try { | |
| document.adoptNode(window.opener.$("#my-iframe")) | |
| } | |
| catch(exc) { | |
| // performance hit. Either importNode, or load the frame contents with appendChild() | |
| document.importNode(window.opener.$("#my-iframe")) | |
| } |