Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'rubygems'
require 'cinch'
bot = Cinch.setup do
server 'irc.freenode.org'
nick 'cardroid'
channels %w[#namaste_bitches]
end
!!!!! DEPRECATION NOTICE !!!!!
The WWW constant is deprecated, please switch to the new top-level Mechanize
constant. WWW will be removed in Mechanize version 2.0
You've referenced the WWW constant from /Users/yossef/bin/southwest_checkin:22, please
switch the "WWW" to "Mechanize". Thanks!
Sincerely,
Pew Pew Pew
class Object
def to_bool
TrueClass === self
end
end
class Numeric
def to_bool
return false if self == 0
return true
end
source :gemcutter
gem 'bundler', '0.9.25'
gem 'net-sftp', '2.0.4'
gem 'state_machine', '0.9.1'
gem 'rails', '2.3.5'
gem 'authlogic', '2.1.3'
gem 'haml', '3.0.3'
gem 'whenever', '0.4.2'
gem 'will_paginate', '2.3.12'
$ irb
irb(main):001:0> things = %w[one two three]
=> ["one", "two", "three"]
irb(main):002:0> things.inject([]) do |result, item|
irb(main):003:1* result + [ [item, "#{item} fish"], [item*2, "#{item} doubled"]]
irb(main):004:1> end
=> [["one", "one fish"], ["oneone", "one doubled"], ["two", "two fish"], ["twotwo", "two doubled"], ["three", "three fish"], ["threethree", "three doubled"]]
irb(main):005:0>
def initialize(options = {})
load_config
set_options(options)
end
photos = photos[0, photos.size > limit ? limit : photos.size]
#############################################################
@order_type = (params[:order_type])?params[:order_type]:"New"
<% @shop_order.attributes.each do |column| %>
<% next if column[0] == 'how_did_you_hear' %>
<input type=hidden name="shop_order[<%=h column[0] %>]" value="<%=h column[1] %>" />
<% end %>
<%# attr_accessors aren't in the attributes array %>
<% @shop_order.accessors.each do |a| %>
<input type=hidden name="shop_order[<%= a %>]" value="<%=h eval("@shop_order."+a) %>" />
<% end %>
class Invitation < ActiveRecord::Base
# Returns encoded invitation id
def encoded_id
self.id*10011981 * 1820062 - 1981
end
def self.decode_id(id)
i = ((id.to_i + 1981)/1820062)/10011981
if (i*10011981 * 1820062 - 1981)==id.to_i
begin
Thing = Struct.new(:a, :b, :c) do
def some_thing
end
end
class Thing
attr_accessor :d
alias_method :old_brackets, :[]
def [](m)