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
Keeping track of items to install with a fresh system. | |
Textmate | |
HAML bundle: https://github.com/phuibonhoa/handcrafted-haml-textmate-bundle |
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
if (![self check]) { [self wreck]; } |
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
def leppard(shotgun) | |
shotgun ? shoot : !shoot | |
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
my.hand = function (upon(your_hip)) { | |
while (i.dip) { | |
you.dip(); | |
we.dip(); | |
} | |
} |
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
0: | |
yds: <5.5 | |
hueco: VB | |
french: <2+ | |
1: | |
yds: 5.5 | |
hueco: VB | |
french: 3- | |
2: | |
yds: 5.6 |
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 RemoveCategoryIdFromItem < ActiveRecord::Migration | |
def self.up | |
# Migrate items from has_many | |
Item.all.each do |item| | |
CategoriesItems.create(:item_id => item.id, :category_id => item.category_id) | |
end | |
remove_column :items, :category_id | |
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
# How I might do it 3 months ago in a different language | |
n = 0 | |
item.categories.each do |category| | |
puts category.title | |
break if n == item.categories.count | |
puts ", " | |
n += 1 | |
end | |
# How I tried it first in ruby |
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
# helper | |
# Set first_time? cookie | |
def set_first_time_cookie | |
cookies[:first_time] = { | |
:value => 'false', | |
:expires => 30.years.from_now, | |
} | |
end | |
# spec |
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
# config/initializers/notifications.rb | |
# created by @JEG2 | |
if Rails.env == "development" | |
ActiveSupport::Notifications.subscribe( | |
"sql.active_record" | |
) do |_, start, finish, _, details| | |
time = finish - start | |
if time >= 0.5 | |
raise "Slow query (#{time}s): #{details[:sql]}" |
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
$ gem install tigerblood | |
$ tiger-commit | |
$ git log | |
commit 395ced32f5bedc29e5002f4b787cc20c497bea1a | |
Author: Charlie Sheen <[email protected]> | |
Date: Tue Apr 26 16:30:28 2011 -0500 | |
testing | |