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 rmate { | |
if [[ $# -eq 1 ]]; then | |
mate "${1}/app" "${1}/config" "${1}/lib" "${1}/public" "${1}/spec" "${1}/stories" | |
else | |
mate "app" "config" "lib" "public" "spec" "stories" | |
fi | |
} |
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
#!/opt/local/bin/bash | |
# .git/hooks/commit-msg | |
exec < /dev/tty | |
commit_message=$1 | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
branch=${ref#refs/heads/} | |
# Exit if commit message empty |
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
# exhibit a | |
{:conditions => case f.to_s | |
when 'active' then {:state => @@states[2]} | |
when 'disabled' then {:state => @@states[0..1]} | |
when 'all' then {} | |
else {:state => @@states[3]} | |
end} | |
# exhibit b | |
case f.to_s |
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
Ruby Wins | |
by James CF | |
C#m G#m F#m A | |
Use a block to print your name, | |
Use equality to test the same, | |
Blocks and lambdas you can call, | |
Private methods, send from all. |
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
Ruby Wins | |
by James CF | |
C#m G#m F#m A | |
Use a block to print your name, | |
Use equality to test the same, | |
Blocks and lambdas you can call, | |
Private methods, send from all. |
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
def build_message | |
message = PORTFOLIO_FIELDS.graph{|field, _| [field, send(field)] } | |
self.message = message.delete_if { |_, value| value.nil? } | |
end |
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
module Math | |
def self.factorial(f) | |
f == 0 ? 1 : f * factorial(f - 1) | |
end | |
end | |
# Or we can extend an instance of Fixnum so we can do 5.factorial :) | |
class Fixnum | |
def factorial | |
self == 0 ? 1 : self * (self - 1).factorial |
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
module Math | |
def self.factorial(f) | |
f == 0 ? 1 : f * factorial(f - 1) | |
end | |
end | |
# Or we can extend an instance of Fixnum so we can do 5.factorial :) | |
class Fixnum | |
def factorial | |
self == 0 ? 1 : self * (self - 1).factorial |
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
// An Unobtrusive Javascript (UJS) driver based on explicit behavior definitions. Just | |
// put a "data-behaviors" attribute on your view elements, and then assign callbacks | |
// for those named behaviors via Behaviors.add. | |
var Behaviors = { | |
add: function(event, behavior, callback) { | |
return $('*[data-behaviors~=' + behavior + ']').bind(event, callback); | |
} | |
}; |
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
Factory.define :post do |post_factory| | |
post_factory.user { Factory.build(:user) } | |
end |
OlderNewer