⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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
class String | |
def anagram?(other) | |
letter_count(self) == letter_count(other) # uses hash equivelence | |
end | |
private | |
# "wwaax" => { "w" => 2, "a" => 2, "x" => 1 }.. all others 0 | |
def letter_count(str) | |
str.downcase.each_char.inject(Hash.new(0)) { |h, ch| h[ch] += 1; h } | |
end |
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
ap.globals.MainBaseView = Backbone.View.extend({ | |
el: $("body"), | |
elements: { | |
$header: $("#header"), | |
$footer: $("#footer"), | |
$secondaryNav: $("nav.secondary"), | |
$pageContent: $(".content-wrapper"), | |
$mainContent: $(".main-content") | |
}, | |
options: { |
Note: This version is a simplified version of this gist; it removes all the unnecessary features (like validations, required parameters, etc).
DCI is a modeling pattern by Trygve Reenskaug, creator of MVC, that is a replacement of sorts for typical OOP.
Note: A simplified version is available in this gist. It removes unnecessary stuff like validations, required parameters, etc.
DCI is a modeling pattern by Trygve Reenskaug, creator of MVC, that is a replacement of sorts for typical OOP.
DCI seperates the domain model (D - Data) from the use cases (C - Context)
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
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz | |
$ tar xzvf ./nginx-0.8.52.tar.gz | |
$ rm ./nginx-0.8.52.tar.gz | |
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc | |
$ passenger-install-nginx-module | |
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation | |
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52 | |
# Where do you want to install Nginx to?: /opt/nginx |
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 CodeSnip = Backbone.Model.extend({ | |
urlRoot: 'code_snips', | |
defaults: { | |
}, | |
initialize: function () { | |
} | |
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
/* | |
*= require_self | |
*/ | |
html, body { | |
background-color: #eee; | |
} | |
body { | |
padding-top: 40px; /* 40px to make the container go all the way to the bottom of the topbar */ | |
} |