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
| pleb:~ will$ irb | |
| >> class Foo; end | |
| => nil | |
| >> Foo.instance_eval { def eeeevil; puts "foo"; end } | |
| => nil | |
| >> Foo.eeeevil | |
| foo | |
| => nil | |
| >> Foo.class_eval { def eeeevil; puts "foo"; end } | |
| => nil |
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
| pleb:~ will$ echo "There's a bright golden haze on the meadow" | gzip -9 > 1.gz | |
| pleb:~ will$ echo "It's a long road to tipperary" | gzip -9 > 2.gz | |
| pleb:~ will$ cat 1.gz 2.gz > 3.gz | |
| pleb:~ will$ cat 3.gz | |
| $?J | |
| ?H-JU/VHTH | |
| pleb:~ will$ gunzip 3.gz | |
| pleb:~ will$ cat 3 | |
| There's a bright golden haze on the meadow | |
| It's a long road to tipperary |
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
| # bigger? '1.3.1.1', '1.4' | |
| def bigger?(a,b) | |
| a_parts = a.split '.' | |
| b_parts = b.split '.' | |
| (a_parts.size > b_parts.size ? a_parts.size : b_parts.size).times {|i| | |
| if (a_parts[i].to_i || 0) > (b_parts[i].to_i || 0) | |
| return(true) | |
| end | |
| if (a_parts[i].to_i || 0) < (b_parts[i].to_i || 0) |
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
| #!/opt/ruby-enterprise-1.8.6-20090201/bin/ruby | |
| require 'rubygems' | |
| require 'hpricot' | |
| require 'open-uri' | |
| require 'uri' | |
| require 'rmail' | |
| require 'mime/types' | |
| require 'base64' | |
| require 'net/smtp' |
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
| Rails::Initializer.run do |config| | |
| config.gem 'wjessop-rack-noie6', :lib => 'noie6' | |
| config.middleware.use "Rack::NoIE6", :minimum => 6.0, :redirect => '/upgrade' | |
| end |
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 SecureController < ApplicationController | |
| layout 'secure' | |
| def booking | |
| @secure = Secure.find(:first, :conditions=>{ :email=>params[:secure][:email], :reference=>params[:secure][:reference]}) | |
| if not @secure.nil? | |
| redirect_to secure_booking2_path and return | |
| else | |
| flash[:warning]="Booking not found" | |
| @secure = Secure.new |
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
| finder_development=> explain analyse SELECT *, (ACOS(least(1,COS(0.659296894483735)*COS(-2.13662186884198)*COS(RADIANS(groups.lat))*COS(RADIANS(groups.lng))+ COS(0.659296894483735)*SIN(-2.13662186884198)*COS(RADIANS(groups.lat))*SIN(RADIANS(groups.lng))+ SIN(0.659296894483735)*SIN(RADIANS(groups.lat))))*6376.77271) AS distance FROM "groups" WHERE (defunct = false AND lat is not null and lng is not null and full_address is not null and full_address != '') ORDER BY (ACOS(least(1,COS(0.659296894483735)*COS(-2.13662186884198)*COS(RADIANS(groups.lat))*COS(RADIANS(groups.lng))+ COS(0.659296894483735)*SIN(-2.13662186884198)*COS(RADIANS(groups.lat))*SIN(RADIANS(groups.lng))+ SIN(0.659296894483735)*SIN(RADIANS(groups.lat))))*6376.77271) ASC, num_members DESC LIMIT 30;; | |
| QUERY PLAN |
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
| finder_development=> explain analyse SELECT *, (ACOS(least(1,COS(0.659296894483735)*COS(-2.13662186884198)*COS(RADIANS(groups.lat))*COS(RADIANS(groups.lng))+ COS(0.659296894483735)*SIN(-2.13662186884198)*COS(RADIANS(groups.lat))*SIN(RADIANS(groups.lng))+ SIN(0.659296894483735)*SIN(RADIANS(groups.lat))))*6376.77271) AS distance FROM "groups" WHERE (defunct = false AND lat is not null and lng is not null and full_address is not null and full_address != '' AND groups.lat>36.8764220242163 AND groups.lat<38.6734369757837 AND groups.lng>-123.556101941199 AND groups.lng<-121.282729058801 AND (ACOS(least(1,COS(0.659296894483735)*COS(-2.13662186884198)*COS(RADIANS(groups.lat))*COS(RADIANS(groups.lng))+ COS(0.659296894483735)*SIN(-2.13662186884198)*COS(RADIANS(groups.lat))*SIN(RADIANS(groups.lng))+ SIN(0.659296894483735)*SIN(RADIANS(groups.lat))))*6376.77271) <= 100) ORDER BY (ACOS(least(1,COS(0.659296894483735)*COS(-2.13662186884198)*COS(RADIANS(groups.lat))*COS(RADIANS(groups.lng))+ COS(0.659296894483735)*SIN(-2.1366 |
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
| require "rubygems" | |
| require "rack" | |
| $log = File.open('wlog', 'w') | |
| def run(server) | |
| require server | |
| s = Rack::Handler.const_get("#{server.capitalize}") | |
| app = proc {|env| | |
| $log.puts env["rack.input"].readlines |
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 MyController < ApplicationController | |
| def listofthings | |
| respond_to do |format| | |
| format.plist { | |
| render :layout => false | |
| } | |
| end | |
| end | |
| end |