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
tags() { | |
dir=$1 | |
if [[ "$dir" == "" ]]; then | |
dir='.' | |
fi | |
if [[ ! -d $dir ]]; then | |
echo $'\e[1;31m'Error: $dir is not a directory.$'\e[0m' | |
return 1 | |
fi |
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
#!/usr/bin/env ruby | |
File.open( 'report.txt', 'w' ) do |io| | |
io.puts <<-EOI | |
Dear Karla, | |
You're fucked, please quit. | |
Regards, | |
The Internet |
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
13:31:08 1.0 ~/work/gems/rubysl-dl $ wc -l `find . -iname '*.rb'` | |
193 ./ext/rubysl/dl/extconf.rb | |
49 ./ext/rubysl/dl/install.rb | |
225 ./ext/rubysl/dl/lib/dl/import.rb | |
149 ./ext/rubysl/dl/lib/dl/struct.rb | |
245 ./ext/rubysl/dl/lib/dl/types.rb | |
25 ./ext/rubysl/dl/lib/dl/win32.rb | |
69 ./ext/rubysl/dl/mkcall.rb | |
63 ./ext/rubysl/dl/mkcallback.rb | |
25 ./ext/rubysl/dl/mkcbtable.rb |
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 User | |
# other stuff | |
def own_and_reviewed_jobs | |
( jobs + Job.where( reviewer: self ) ).uniq | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.macports.gpg-agent</string> | |
<!-- Please uncomment on 10.4; OnDemand doesn't work properly there. --> | |
<!-- | |
<key>OnDemand</key> |
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
09:39:14 ~/work/r4.2.0 $ rails c | |
Loading development environment (Rails 4.2.0) | |
[1] pry(main)> f = Foo.first | |
Foo Load (0.3ms) SELECT "foos".* FROM "foos" ORDER BY "foos"."id" ASC LIMIT 1 | |
=> #<Foo:0x007fa18bf146c0 id: 1, name: "Jason", age: 44, created_at: Wed, 07 Jan 2015 01:52:26 UTC +00:00, updated_at: Wed, 07 Jan 2015 01:59:01 UTC +00:00> | |
[2] pry(main)> show-source f.wee | |
From: /Users/jk/work/r4.2.0/app/models/foo.rb @ line 7: | |
Owner: Foo | |
Visibility: public |
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
[20] pry(main)> class Foo < ActiveRecord::Base | |
[20] pry(main)* end | |
=> nil | |
[21] pry(main)> f = Foo.new phone_numbers: {"dario" => "12345"} | |
=> #<Foo:0x007fc69ba76228 id: nil, name: nil, phone_numbers: "{\"dario\"=>\"12345\"}", created_at: nil, updated_at: nil> | |
[22] pry(main)> f.phone_numbers.class | |
=> String | |
[23] pry(main)> class Foo < ActiveRecord::Base | |
[23] pry(main)* serialize :phone_numbers | |
[23] pry(main)* 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
12:18:33 ~/work/r42 $ rails c | |
Loading development environment (Rails 4.2.0) | |
irb(main):001:0> app.foos_path | |
=> "/foos" | |
irb(main):002:0> app.foos_url | |
=> "http://www.example.com/foos" | |
irb(main):003:0> |
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
15:14:47 master ~/work/r42 $ ag "(def|alias).*assert_not_includes" `bundle list --paths` | |
/Users/jk/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/test_case.rb | |
81: alias :assert_not_includes :refute_includes |
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
[76] pry(main)> class FooBar < ActiveRecord::Base | |
[76] pry(main)* scope :broken, -> { "UH OH" } | |
[76] pry(main)* end | |
=> :broken | |
[77] pry(main)> FooBar.broken.where name: "NOPE!" | |
NoMethodError: undefined method `where' for "UH OH":String | |
from (pry):65:in `__pry__' |
OlderNewer