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
testing gist |
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
# General | |
alias l='ls -lash -G' | |
alias ll='ls -lash -G' | |
alias h='history' | |
alias flush='sudo dscacheutil -flushcache' | |
# ruby | |
alias mygems="gem list | grep ’^[a-zA-Z]’" | |
# Rails |
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 app = { | |
before: function () { console.log("i am going to be runned before all other functions") }, | |
func1: function () { | |
console.log("func1"); | |
}, | |
func2: function () { | |
console.log("func2"); | |
} |
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 app = { | |
before: function () { console.log("i am going to be runned before all other functions") }, | |
func1: function () { | |
console.log("func1"); | |
}, | |
func2: function () { | |
console.log("func2"); | |
} |
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
// Simplified example | |
App.Controllers.Sales = Object.create(App.Controllers.Master, { | |
all: function () { | |
// Find all method on Sale initiates a callback when data has returnes | |
App.Models.Sale.findAll(function () { | |
// render method on $ initiate a callback when the template has been loaded in the dom | |
$('contentarea').render("sales/all", function (sales) { | |
// Pure template autoRender method finds some id and auto loops over and array | |
$('#id-of-a-list-of-sales').autoRender(sales); |
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 () { | |
var PublicAPI = window.PublicAPI = {}; | |
PublicAPI.publicFunction = function (foo) { | |
PrivateAPI.privateFunction(foo); | |
return 'bar'; | |
}; | |
var PrivateAPI = {}; | |
PrivateAPI.privateFunction = function (foo) { |
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 () { | |
var PublicAPI = window.PublicAPI = {}; | |
PublicAPI.publicFunction = function (foo) { | |
PrivateAPI.privateFunction(foo); | |
return 'bar'; | |
}; | |
var PrivateAPI = {}; | |
PrivateAPI.privateFunction = function (foo) { |
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
# Classical | |
class Animal | |
color: 'brown' | |
sleep: (minutes) -> | |
"sleeping for " + minutes + " minutes" | |
class Horse extends Animal | |
legs: 4 | |
gallop: -> | |
"galloping happily" |
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
# http://en.wikipedia.org/wiki/Bank_card_number | |
CARDTYPES = { | |
:visa => /^4(?!571|917|913|508|844|17500)[0-9]{12,15}$/, | |
:mastercard => /^5(?!4130380)[1-5][0-9]{14}$/, | |
:dinersclub => /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/, | |
:amex => /^3[47][0-9]{13}$/, | |
:discover => /^6(?:011|5[0-9]{2})[0-9]{12}$/, | |
:visadankort => /^4571[0-9]{12}$/, | |
:dankort => /^5019[0-9]{12}$/, | |
:eurocardbyinvitation => /^54130380\d{8}/, |
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 () { | |
W.GET("/", function () { | |
$('#app').html("Hello World"); | |
}); | |
W.GET("#users", function () { | |
$('#app').html("users"); | |
}); | |