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 stuff | |
magic! | |
puts "ciao" | |
end | |
def magic | |
at_caller_method_exit { puts "magic!" } | |
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
mecbucpro:tmp postgres$ /Library/PostgreSQL/9.2/bin/pg_upgrade --old-port 5432 --new-port 5433 --old-datadir /Library/PostgreSQL/9.1/data/ --new-datadir /Library/PostgreSQL/9.2/data/ --old-bindir /Library/PostgreSQL/9.1/bin/ --new-bindir /Library/PostgreSQL/9.2/bin/ --verbose --link --retain --check --user=postgres | |
Running in verbose mode | |
Performing Consistency Checks | |
----------------------------- | |
Checking current, bin, and data directories ok | |
Checking cluster versions ok | |
pg_control values: | |
First log file ID after reset: 28 | |
First log file segment after reset: 215 |
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
# possible now | |
def retrying times=x # or strategy | |
attempt = 0 | |
yield | |
rescue | |
attempt+=1 | |
retry if attempt < times # or retry if strategy | |
end | |
retrying(1) { open_url } |
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
# assumes you have the dump in the same dir as combo_not.txt | |
require 'digest/sha1' | |
puts "insert password" | |
system "stty -echo" | |
pass = gets.chomp | |
system "stty echo" | |
hex= Digest::SHA1.hexdigest(pass) | |
puts hex | |
system "grep #{hex} combo_not.txt" | |
hex.sub!(/^...../,'00000') |
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
<!DOCTYPE html> | |
<html xmlns:fb="http://www.facebook.com/2008/fbml"> | |
<head> | |
<meta charset="utf-8"> | |
<title> | |
All Topics | |
- The Latest News Headlines, Videos and Images |
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
#matches something like an s-expression | |
R = %r@ | |
(?<atom> [-\w]+){0} | |
(?<quote> '\g<expr>){0} | |
(?<expr> | |
\g<atom> | | |
\g<quote> | | |
\( | |
\g<expr> | |
(?<exprs> (\s+ \g<expr>)* ) |
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
>> 'asd'.pronounceable? | |
=> 0.3333333333333333 | |
>> 'sdf'.pronounceable? | |
=> 0.3333333333333333 | |
>> 'skdf'.pronounceable? | |
=> 0.25 | |
>> 'skadf'.pronounceable? | |
=> 0.6 | |
>> 'skadkf'.pronounceable? | |
=> 0.5 |
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
mecbucpro:~ riffraff$ ruby -e "Float('0.0')" | |
_____________________________________________________________________________ | |
| Configuration Files | | |
| | | |
| System File: /Users/riffraff/.rvm/rubies/maglev-head/etc/system.conf | | |
| | | |
| Executable File: /Users/riffraff/gem.conf | | |
| Warning: File not found (errno=2,ENOENT, The file or directory specified cannot | |
| be found) | |
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
Suggestions from 2011/08/05 for non-obvious SF/Fantasy movies, with many thanks to anyone who answered. Apparently thee isn't much new for me but they were all great suggestions! | |
- gattaca (suggested twice. Great movie, but also quite known imho) | |
- dark city (loved it, generally underrated imho) | |
- primer (mindbending, cheaply made, very geeky) | |
- La jetée (TBD) | |
- pandorum (arguably the best "in space" movie to come out recently | |
- I'm a cyborg, but that's ok (not sci-fi but very enjoyable) | |
- Videodrome (masterpiece, very old but very famous) | |
- Aeon Flux (real actors movie: meh; animation: kewl) |
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
task 'run' => :environment do | |
RubyProf.start | |
Bullet.enable=true | |
Bullet.start_request | |
20.times do | |
r = Rating.limit(20).includes(:comment => :post).to_a | |
end | |
Bullet.end_request | |
results = RubyProf.stop |