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
alias ll="ls -alh" | |
alias rss="ruby script/server" | |
alias rss4="ruby script/server -p 4000" | |
alias rssp="ruby script/server -e production" | |
alias rsc="ruby script/console" | |
alias rsa="ruby script/about" | |
alias rsg="ruby script/generate" | |
alias rsgm="ruby script/generate migration" | |
alias rsgrm="ruby script/generate rspec_model" |
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
#using the attr_accessible declaration to whitelist mass-assignable attributes | |
#this example will only update title and body when performing a Post.new(params[:post]) or @post.update_attributes(params[:post]) | |
#even if params[:post] contains other keys and values (i.e. thread_id will not be overwritten this way) | |
class Post | |
belongs_to :thread | |
attr_accessible :title, :body | |
end | |
class PostsController < ApplicationController | |
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
/** | |
* Recursively counts the number of DOM domNodes inside a given domNode | |
* @param {DomNode} domNome The DOM node to count children for (defaults to the body DOM node) | |
* @return {Number} The number of DOM nodes inside this domNode | |
*/ | |
countNodes = function(domNode) { | |
var domNode = domNode || document.body; | |
var runningTotal = 1; //this domNode | |
if (domNode.childNodes.length > 0) { |
NewerOlder