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 building command-line @posterous clients, write "signature" feature which links to the blog auto-posted from (make it visible only on @posterous by including simple JavaScript) |
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
namespace :myapp do | |
def invoke(tasks) # did I really need to write this method? aargh | |
tasks.each {|t| Rake::Task[t].invoke} | |
end | |
desc "dump everything (in order to re-seed)" | |
task :renew do | |
invoke(%w{db:drop db:create db:migrate}) | |
end | |
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
$().ready(function() { | |
$("<style type='text/css'>.trends-inner{ display: none }</style>").appendTo("head"); | |
$("<style type='text/css'>p.promo{ display: none }</style>").appendTo("head"); | |
}); |
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_src() { | |
pushd ~/.rvm/gems/`rvm-prompt | sed -e s/\@/\\\\\@/`/gems | |
} |
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
#!/opt/local/bin/ruby | |
# supa primitive script to access today's journal entry text file | |
now = Time.now | |
month = now.month.to_s | |
month = "0" + month if month.to_i < 10 | |
day = now.mday.to_s | |
day = "0" + day if day.to_i < 10 | |
date = month + day + now.year.to_s[2,3] |
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
1 class User < ActiveRecord::Base | |
2 attr_accessible :password, :password_confirmation | |
3 | |
4 def passwd=(new_pass) | |
5 self.password = self.password_confirmation = new_pass | |
6 end | |
7 end | |
8 | |
~ |
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
49 def deprecate name, repl, year, month | |
50 class_eval { | |
51 old = "_deprecated_#{name}" | |
52 alias_method old, name | |
53 define_method name do |*args, &block| # TODO: really works on 1.8.7? | |
54 klass = self.kind_of? Module | |
55 target = klass ? "#{self}." : "#{self.class}#" | |
56 msg = [ "NOTE: #{target}#{name} is deprecated", | |
57 repl == :none ? " with no replacement" : ", use #{repl}", | |
58 ". It will be removed on or after %4d-%02d-01." % [year, month], |
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
1 $().ready(function() { | |
2 // don't show me trending topics | |
3 $("<style type='text/css'>.trends-inner{ display: none }</style>").appendTo("head"); | |
4 | |
5 // don't show me promoted tweets | |
6 $("<style type='text/css'>p.promo{ display: none }</style>").appendTo("head"); | |
7 | |
8 // don't recommend that I follow anybody | |
9 $("<style type='text/css'>.user-rec-component{ display: none }</style>").appendTo("head"); | |
10 |
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
<airbook:giles> [06-10 16:05] ruby-1.8.7-p334 | |
↪ bundle install | |
You can no longer specify a git source by itself. Instead, | |
either use the :git option on a gem, or specify the gems that | |
bundler should find in the git source by passing a block to | |
the git method, like: | |
git 'git://github.com/rails/rails.git' do | |
gem 'rails' | |
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
1 class LegacyParent < LegacyBase | |
2 set_table_name :widgets | |
3 | |
4 # in order to differentiate subclasses in the migrations, we need to be able to get at them | |
5 # via ActiveRecord finders and their "type" attributes. that means we have to tell ActiveRecord | |
6 # that the type attribute isn't off-limits, which it seems we have to do by telling it we | |
7 # have some other attribute used for STI inheritance instead | |
8 set_inheritance_column :fake_column_name | |
9 def map | |
10 puts :wtf |