This file contains hidden or 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/local/bin/ruby | |
| require 'rubygems' | |
| require 'open-uri' | |
| require 'hpricot' | |
| require 'pp' | |
| html = open('http://eska.pl/index.php?page=g20_voting').read | |
| doc = Hpricot(html) |
This file contains hidden or 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
| package MojSexyLib; | |
| sub new { | |
| my $self = {}; | |
| bless $self; | |
| return $self; | |
| } | |
| sub dupa1 { } | |
| sub dupa2 { } |
This file contains hidden or 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
| module AutoParams | |
| def auto_set(params={}) | |
| params.each_pair do |key,value| | |
| self.instance_eval("@#{key} = '#{value}'") | |
| end | |
| end | |
| end | |
| class Human |
This file contains hidden or 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
| my $str = "UPDATE cd_firstdata_auth SET \ | |
| fda_invoice_id='74937', \ | |
| fda_invoice_name='plg_invoice', \ | |
| fda_auth_no='G2 C3LS', \ | |
| fda_term_no='0', \ | |
| fda_modified=NOW(), \ | |
| fda_modified_by='6', \ | |
| fda_type='M' WHERE \ | |
| fda_id = '1' AND (\ | |
| fda_auth_no != 'G2C3LS' || \ |
This file contains hidden or 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 Project < ActiveRecord::Base | |
| # include OpenFeatures | |
| def self.inheritance_column | |
| "fuck OFF" | |
| end | |
| set_table_name 'user_trackit' | |
| set_primary_key 'userid' | |
| belongs_to :user |
This file contains hidden or 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/local/bin/ruby | |
| require 'rubygems' | |
| require 'mechanize' | |
| require 'pp' | |
| user = 'user' | |
| pass = 'pass' | |
| agent = WWW::Mechanize.new { |a| |
This file contains hidden or 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
| Processing ApplicationController#create (for 87.204.150.226 at 2009-11-24 11:29:44) [POST] | |
| Parameters: {"commit"=>"Dodaj!", "account"=>{"xxx_id"=>"2222", "password"=>"[FILTERED]"}, "action"=>"create", "controller"=>"accounts"} | |
| NoMethodError (undefined method `each' for 0:Fixnum): | |
| /usr/lib/ruby/gems/1.8/gems/thin-1.0.0/lib/thin/connection.rb:63:in `pre_process' | |
| /usr/lib/ruby/gems/1.8/gems/thin-1.0.0/lib/thin/connection.rb:54:in `process' | |
| /usr/lib/ruby/gems/1.8/gems/thin-1.0.0/lib/thin/connection.rb:39:in `receive_data' | |
| /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.0/lib/eventmachine.rb:224:in `run_machine' | |
| /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.0/lib/eventmachine.rb:224:in `run' | |
| /usr/lib/ruby/gems/1.8/gems/thin-1.0.0/lib/thin/backends/base.rb:57:in `start' |
This file contains hidden or 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
| # Based on from: http://blog.codefront.net/2008/01/14/retrying-code-blocks-in-ruby-on-exceptions-whatever/ | |
| def retryable_deluxe(options = {}, &block) | |
| opts = { :tries => 1, :on => { :exception => Exception, :return => false } }.merge(options) | |
| retry_opt, retries = opts[:on], opts[:tries] | |
| retry_exception = retry_opt[:exception] | |
| retry_return = retry_opt[:return] | |
| retries_max = retries + 1 |
This file contains hidden or 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/local/bin/ruby | |
| require 'rubygems' | |
| require 'net/ssh' | |
| print "User: " | |
| user = gets.chomp! | |
| print "Password: " | |
| password = gets.chomp! |
This file contains hidden or 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
| michalkurek@nil ~/rails/messge_monster $ ./script/about | |
| Ruby version 1.8.6 (i686-darwin9.8.0) | |
| RubyGems version 1.3.5 | |
| Rack version 1.0 | |
| Rails version 2.3.4 | |
| Active Record version 2.3.4 | |
| Active Resource version 2.3.4 | |
| Action Mailer version 2.3.4 | |
| Active Support version 2.3.4 | |
| Environment development |