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 | |
# Put this in your bin directory or wherever you like; chmod +x it, and then you can use it like this: | |
# textile my-document.textile > my-document.html | |
# If you use vim, the following line gives you instant preview of your document. I know, it can be done better (.vim/ftplugin/textile.vim) | |
# nnoremap <F5> :!textile % > /tmp/textile-preview.html && gnome-open /tmp/textile-preview.html<CR><CR> | |
require 'rubygems' | |
require 'RedCloth' | |
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
/!\ FAILSAFE /!\ Fri, 21 Nov 2008 09:21:33 +0000 | |
Status: 500 Internal Server Error | |
wrong number of arguments (1 for 0) | |
/opt/ruby-1.8.6/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/quoting.rb:61:in `to_s' | |
/opt/ruby-1.8.6/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/quoting.rb:61:in `quoted_date' | |
/opt/ruby-1.8.6/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/quoting.rb:29:in `quote' | |
/opt/ruby-1.8.6/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/mysql_adapter.rb:224:in `quote' | |
/opt/ruby-1.8.6/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:2594:in `attributes_with_quotes' | |
/opt/ruby-1.8.6/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:2585:in `each' | |
/opt/ruby-1.8.6/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:2585:in `attributes_with_quotes' |
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
allowed = 'A-Za-z0-9' | |
q = /^(([#{allowed}]+)([#{allowed}\-]+)([#{allowed}]+)|([#{allowed}]{1,2}))$/ | |
p q =~ 'aa' | |
p q =~ 'aaa' | |
p q =~ 'aa-aa' | |
p q =~ '9aa-aa' | |
p q =~ '90' | |
p '---- not from down -----' |
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
# Include hook code here | |
class ActionController::Routing::RouteSet::Mapper | |
def languages(*options) | |
$LANGUAGES = options.map &:to_s # ugly. Any other idea? | |
end | |
end | |
# Brutal hack, in the guts. May not work with any other version. |
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
win_coef = self.win(profile, scope).to_f/100 | |
avg_win_coef = self.average(profile, scope, :wins) | |
avg_lose_coef = self.average(profile, scope, :losses) | |
(win_coef * avg_win_coef) + ((100 - win_coef) * (-avg_lose_coef)).to_i |
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
#!/bin/bash | |
for daemon in $(cat daemons); do | |
!(ps ax | grep "$daemon" | grep -v grep > /dev/null) && echo $daemon | |
done |
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
# google toolbar fix | |
rewrite ^(.+)favicon\.ico$ /favicon.ico last; |
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
petyo@t400:~/Test$ cat test.rb fail.rb | |
#!/usr/bin/env ruby | |
require 'English' | |
require 'rubygems' | |
require 'ruby-debug' | |
pid = fork { exec("./fail.rb &> /dev/null") } |
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
xterm -fg white -bg black -fa Consolas-9 -fs 9 -j -maximized -s +sb -e screen |
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
a = 0 | |
(1..10000000).to_a.each { |x| a = x + 1} |
OlderNewer