Skip to content

Instantly share code, notes, and snippets.

View mculp's full-sized avatar
🎨
arting

Matt Culpepper mculp

🎨
arting
View GitHub Profile
# so, we had a bug from a line of code doing this:
something_that_may_be_symbol_or_str.to_s +"something"
# => undefined method `+@' for "something":String
# TIL:
Derp = Class.new { def +@; puts 'WAT'; end }
# => Derp
+Derp.new
# => WAT
// IDDA v0.99b5 config file
// IDDA Q2WF cfg v1.3 by Rom
// See comments for more info
// All games
weapon 0 "all weapons"
# link_to 'profile', new_or_edit_path(@profile)
def new_or_edit_path(resource)
resource_name = resource.class.name.underscore
resource ? __send__("edit_#{resource_name}_path", resource) : __send__("new_#{resource_name}_path")
end
def to_param
fields = [self.company, self.executive_first_name, self.executive_last_name].compact
fields.map! &:parameterize
[self.id, *fields].join('-')
end
def show
begin
month = Date.parse(params[:month])
rescue
flash[:error] = 'Invalid date.'
redirect_to admin_reports_path and return
end
@auctions = Auction.completed.where("updated_at > ? and updated_at <= ?", month, month.end_of_month)
└─[$]> ping google.com
PING google.com (74.125.137.100): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
64 bytes from 74.125.137.100: icmp_seq=0 ttl=48 time=2215.786 ms
Request timeout for icmp_seq 3
64 bytes from 74.125.137.100: icmp_seq=1 ttl=48 time=3850.339 ms
64 bytes from 74.125.137.100: icmp_seq=2 ttl=48 time=2953.793 ms
Request timeout for icmp_seq 6
64 bytes from 74.125.137.100: icmp_seq=3 ttl=48 time=4572.678 ms
if ENV['BONSAI_INDEX_URL']
Tire.configure do
url "http://index.bonsai.io"
end
BONSAI_INDEX_NAME = ENV['BONSAI_INDEX_URL'][/[^\/]+$/]
else
app_name = Rails.application.class.parent_name.underscore.dasherize
app_env = Rails.env
BONSAI_INDEX_NAME = "#{app_name}-#{app_env}"
end
irb(main):001:0> directions = %w[DESC ASC]
=> ["DESC", "ASC"]
irb(main):002:0> directions.instance_eval { def toggle(direction); self - [direction]; end }
=> nil
irb(main):003:0> directions.toggle('ASC')
=> ["DESC"]
@mculp
mculp / 1-Gemfile
Created November 6, 2012 01:50
what is wrong with this picture? getting larger photo from linked in
gem 'linkedin'
.autocomplete {
z-index: 10020;
position: absolute;
background: rgba(255,255,255,0.9);
width: 205px;
font-family: "Helvetica Neue", "Helvetica", Arial, sans-serif;
font-size: 14px;
color: #000;
border: 1px solid #b4becd;
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.2);