Skip to content

Instantly share code, notes, and snippets.

View ymichael's full-sized avatar

Michael Yong ymichael

View GitHub Profile
@ymichael
ymichael / npmoutput.txt
Created March 4, 2012 16:08
npm output
// 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
@ymichael
ymichael / gist:2259927
Created March 31, 2012 06:21
requirejs boilerplate
define([
//add dependencies here
'jquery'
, 'underscore'
, 'backbone'
],
function($,_,Backbone){
var obj = {};
@ymichael
ymichael / gist:2260016
Created March 31, 2012 06:33
only script tag
<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",
@ymichael
ymichael / gist:2260134
Created March 31, 2012 06:53
app build
({
baseUrl: ".",
name: "main",
out: "../../build/js/main.js",
paths: {
'jquery': "empty:",
'underscore': "libs/underscore",
'backbone': "libs/backbone",
'ich': "libs/icanhazamd",
'ivle': "libs/ivle",
@ymichael
ymichael / snippet.js
Created April 3, 2012 16:39 — forked from christopherdebeer/snippet.js
Node.js Express - Mobile detection
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');
}
});
@ymichael
ymichael / gist:2301402
Created April 4, 2012 14:12
ivle module endpoint
https://ivle.nus.edu.sg/api/Lapi.svc/Modules?APIKey={{ api key }}&AuthToken={{ auth token }}&Duration=0&IncludeAllInfo=false&output=json
@ymichael
ymichael / app.js
Created May 4, 2012 04:13 — forked from dbainbridge/app.js
How to use socket.io with Express 3
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http');
var app = express();
var server = app.listen(3000);
@ymichael
ymichael / jediscript_styleguide.md
Created August 22, 2012 17:28
JediScript Style Guide Draft

JediScript Style Guide

Indentation

  • Use a four space indent.

Semicolons

  • Terminate all statements with a semicolon ;

Curly Braces

  • Curly braces should open on the same line and close on a new line