Skip to content

Instantly share code, notes, and snippets.

system ~/projects/stay_with_a_local (master) $> git push heroku master
Counting objects: 238, done.
Compressing objects: 100% (211/211), done.
Writing objects: 100% (227/227), 356.40 KiB, done.
Total 227 (delta 116), reused 0 (delta 0)
-----> Heroku receiving push
-----> Installing gem compass 0.8.17 from http://gemcutter.org, http://gems.rubyforge.org
Successfully installed compass-0.8.17
ruby-1.9.1-p378 ~/playground $> rails reading_list
/Users/john/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta3/lib/rails/generators.rb:6:in `require': no such file to load -- active_support/core_ext/kernel/singleton_class (LoadError)
from /Users/john/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta3/lib/rails/generators.rb:6:in `<top (required)>'
from /Users/john/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta3/lib/rails/commands/application.rb:10:in `require'
from /Users/john/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta3/lib/rails/commands/application.rb:10:in `<top (required)>'
from /Users/john/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta3/lib/rails/cli.rb:30:in `require'
from /Users/john/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta3/lib/rails/cli.rb:30:in `<top (required)>'
from /Users/john/.rvm/gems/ruby-1.9.1-p378/gems/rails-3.0.0.beta3/bin/rails:1:in `require'
from /Users/john/.rvm/gems/ruby-1.9.1-p378/gems/rails-3.0.0.be

Hey Scott, this is the hacky highlighting I did with code snippets in showoff.

Refer to http://i-dont-trust-your-code.heroku.com/ for the presentation and http://github.com/jtrupiano/i_dont_trust_your_code for the code.

In this first example, I am successively highlighting lines of code from a source file. Refer to slides 22-28 in the presentation and 2-environment/3-custom-require.md in the source.

In the second example, I am highlighting lines of code from irb and shell sessions. Refer to slides 6-13 in the presentation and 2-environment/1-environment.md in the source. What I'd really like to be able to further do is highlight individual results from the ls commands on slides 8 and 10, but that was going to b

@jtrupiano
jtrupiano / gist:334853
Created March 17, 2010 03:22
Use sed and awk to help me cleanse the first commit in a git repo
# Process used to ammend a commit way back in my log (to eliminate some sensitive information)
# Print the git log to a temp file
git log --pretty=oneline > git.log
git checkout -b new_branch SHA
# edit and ammend
git commit -a --amend
# Use sed to reverse the lines in the file
@jtrupiano
jtrupiano / gist:334413
Created March 16, 2010 19:44
Should factory_girl bypass :attr_accessible by default?
# factory_girl has difficulty playing nicely with attr_accessible.
class Article
belongs_to :owner
attr_accessible :name
end
Factory.define(:article) do |a|
a.association :owner
a.sequence(:name) {|i| "Article #{i}"}
~/projects/ignite/git (master) $> gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.6
- RUBY VERSION: 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-9
/Users/john/.rvm/gems/ruby-1.8.7-p249/bin/rake:
#!/usr/bin/env ruby
system:
uname: "Darwin john-mbp.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386"
shell: "bash"
version: "3.2.17(1)-release"
ruby:
interpreter: "ruby"
version: "1.8.7"
date: "2010-01-10"
platform: "i686-darwin9.8.0"
ruby-1.8.7-p249 ~/projects/gemcutter (master) $> rake -T
(in /Users/john/projects/gemcutter)
[BUG] cross-thread violation on rb_gc()
ruby 1.8.6 (2008-08-11) [universal-darwin9.0]
Abort trap
named_scope :with_versions, lambda {
opts = {:joins => :versions}
ids = Version.find(:all, :select => 'rubygem_id').map(&:rubygem_id)
ids.empty? ? opts : opts.merge(:conditions => ["id IN ?", ids])
}