HTTP Verb Path Controller#Action Used for
GET /photos photos#index display a list of all photos
GET /photos/new photos#new return an HTML form for creating a new photo
POST /photos photos#create create a new photo
GET /photos/:id photos#show display a specific photo
GET /photos/:id/edit photos#edit return an HTML form for editing a photo
PATCH/PUT /photos/:id photos#update update a specific photo
DELETE /photos/:id photos#destroy delete a specific photo
This file contains 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 calcStandardDeviation(arr) { | |
// var arr = [23, 37, 45, 49, 56, 63, 63, 70, 72, 82]; | |
var count = arr.length | |
var mean = arr.reduce(function(total, num) { | |
total += num; | |
return total; | |
}, 0) / count; | |
var variance = arr.reduce(function(total, num) { |
This file contains 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
# Getting started with Ruby | |
# http://guides.rubyonrails.org/getting_started.html | |
# Install ruby | |
curl -L https://get.rvm.io | bash -s stable --ruby | |
# Install ruby 1.8.7, since rvm installs 1.8.7 as default | |
rvm install 1.9.3 | |
rvm --default use 1.9.3 |
This file contains 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 ItemModel = Backbone.Model.extend({ | |
defaults : { | |
"item_id" : 0, | |
"item_content" : "this is a content" | |
} | |
}); | |
var ItemColl = Backbone.Collection.extend({ |
This file contains 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 redisConfig = { | |
"host" : "localhost", | |
"port" : "6379", | |
"maxConnections" : 10, | |
"minConnections" : 5, | |
"debug" : true | |
} | |
var redis = require("redis"); |
This file contains 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
vi ~/.bashrc | |
# [add the following] | |
# ------------------------------------------------------------- | |
. ~/.nvm/nvm.sh && nvm use default | |
# ------------------------------------------------------------- | |
mkdir ~/src | |
cd !$ |
This file contains 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 Person = function () { | |
this.fname = 'douglas'; | |
this.lname = 'crockford'; | |
}; | |
var Student = function() { | |
return this; | |
}; | |
Student.prototype = new Person(); |
This file contains 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 MyArray = function() { return this; } ; | |
MyArray.prototype = new Array(); | |
MyArray.prototype.constructor = MyArray; // http://stackoverflow.com/a/10430875/842214 | |
Object.defineProperty(MyArray.prototype, 'myLast', (function () { | |
return { | |
configurable : true, | |
enumerable : true, | |
get : function () { | |
return this[this.length - 1]; |
This file contains 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
Host app-nat | |
Hostname app-nat.example.com | |
User app-nat-user | |
IdentityFile ~/.ssh/app-nat-id_rsa | |
Host app-remote | |
ProxyCommand ssh -q app-nat nc app-remote.example.com 22 | |
User app-remote-user | |
IdentityFile ~/.ssh/app-remote-id_rsa |
This file contains 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() { | |
// angular.module('TwttrMaxlengthDirectiveDemo', ['ngMaterial']) | |
// .constant('twttr', twttr) // https://github.com/twitter/twitter-text/tree/master/js | |
// .directive('twttrMaxlength', TwttrMaxlengthDirective); | |
TwttrMaxlengthDirective.$inject = ['$animate', 'twttr']; | |
function TwttrMaxlengthDirective($animate, twttr) { | |
return { |