- Use a four space indent.
- Terminate all statements with a semicolon
;
- Curly braces should open on the same line and close on a new line
| // installed fine | |
| michael:~ michael$ sudo npm cache clean | |
| Password: | |
| michael:~ michael$ sudo npm install forever -g | |
| npm http GET https://registry.npmjs.org/forever | |
| npm http 200 https://registry.npmjs.org/forever | |
| npm http GET https://registry.npmjs.org/forever/-/forever-0.8.5.tgz | |
| npm http 200 https://registry.npmjs.org/forever/-/forever-0.8.5.tgz | |
| npm http GET https://registry.npmjs.org/broadway |
| #Newbie programmer | |
| def factorial(x): | |
| if x == 0: | |
| return 1 | |
| else: | |
| return x * factorial(x - 1) | |
| print factorial(6) | |
| #First year programmer, studied Pascal |
| define([ | |
| //add dependencies here | |
| 'jquery' | |
| , 'underscore' | |
| , 'backbone' | |
| ], | |
| function($,_,Backbone){ | |
| var obj = {}; |
| <script data-main="path/to/main" src="path/to/require.js"></script> |
| require.config({ | |
| paths: { | |
| // i use jquery cdn to speed up my page load | |
| 'jquery': "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min", | |
| 'underscore': "libs/underscore", | |
| 'backbone': "libs/backbone", | |
| // other scripts | |
| 'ich': "libs/icanhazamd", |
| ({ | |
| baseUrl: ".", | |
| name: "main", | |
| out: "../../build/js/main.js", | |
| paths: { | |
| 'jquery': "empty:", | |
| 'underscore': "libs/underscore", | |
| 'backbone': "libs/backbone", | |
| 'ich': "libs/icanhazamd", | |
| 'ivle': "libs/ivle", |
| app.get('/', function(req, res){ | |
| var ua = req.header('user-agent'); | |
| if(/mobile/i.test(ua)) { | |
| res.render('mobile.html'); | |
| } else { | |
| res.render('desktop.html'); | |
| } | |
| }); |
| https://ivle.nus.edu.sg/api/Lapi.svc/Modules?APIKey={{ api key }}&AuthToken={{ auth token }}&Duration=0&IncludeAllInfo=false&output=json |
| /** | |
| * Module dependencies. | |
| */ | |
| var express = require('express') | |
| , routes = require('./routes') | |
| , http = require('http'); | |
| var app = express(); | |
| var server = app.listen(3000); |