Skip to content

Instantly share code, notes, and snippets.

View chadoh's full-sized avatar
🌲

Chad Ostrowski chadoh

🌲
View GitHub Profile
%div
.who-and-when
.avatar
= modification.avatar
suggested by
= modification.created_by
= modification.created_at
.description
= modification.friendly_description
@chadoh
chadoh / Error.txt
Created May 15, 2012 19:50 — forked from tatey/benchmark.rb
Mocha VS MiniTest::Mock and SimpleDelegate VS SimpleMock
⮁ ruby benchmark.rb > benchmark.txt
benchmark.rb:33:in `block (3 levels) in <main>': undefined method `push' for #<RR::DoubleDefinitions::DoubleDefinition:0x007fe9aa28e240> (NoMethodError)
from benchmark.rb:31:in `times'
from benchmark.rb:31:in `block (2 levels) in <main>'
from /Users/costro0001/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
from /Users/costro0001/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/benchmark.rb:362:in `item'
from benchmark.rb:30:in `block in <main>'
from /Users/costro0001/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/benchmark.rb:174:in `benchmark'
from /Users/costro0001/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/benchmark.rb:205:in `bm'
from benchmark.rb:11:in `<main>'
@chadoh
chadoh / Gemfile
Created June 14, 2012 19:39
settings at revision bdc4965
source ':-D'
source :rubygems
gem 'rails', '~> 3.1.4'
gem 'rake', '~> 0.9.2'
gem 'mysql2', '~> 0.3.11'
gem 'activerecord-sqlserver-adapter', '~> 3.1.4' # must match rails minor version
gem 'tiny_tds'
@chadoh
chadoh / Gemfile
Created June 14, 2012 19:44
settings at revision 1123493
source ":-D"
source :rubygems
gem "rails", "~> 3.1.4"
gem "rake", "~> 0.9.2"
gem "mysql2", "~> 0.3.11"
gem "activerecord-sqlserver-adapter", "~> 3.1.4" # must match rails minor version
gem "tiny_tds"
$(function(){
/* currency converter */
$('#link-currency').click(function(e){
e.preventDefault();
$('#popup-currency').toggleClass('active');
});
/* add style to form when input is highlighted */
$('#bid_amount').focus(function(){ $('form#new_bid').addClass('focused'); });
@chadoh
chadoh / auction_helper.rb
Created October 31, 2012 15:55
What language uses this sort of pattern? It certainly isn't Ruby!
def auction_date_range(auction, format)
return unless auction.start_date && auction.end_date
returning([auction.start_date.eztime(format), auction.end_date.eztime(format)]) do |a|
def a.to_s; join(' to '); end
end
end
def lot_date_range(lot, format)
return unless lot.open_date && lot.close_date
returning([lot.open_date.eztime(format), lot.close_date.eztime(format)]) do |a|
Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.8.0
gem uninstall nokogiri -xI;
brew update;
brew uninstall libxml2;
brew install libxml2 --with-xml2-config;
brew link libxml2;
brew install libxslt;
#!/bin/bash
# This script will switch all textual columns in your db to a new encoding
# without switching the actual bytes in those columns. If you had a dumb
# programming language like Ruby 1.8 that dumped a bunch of utf8-encoded
# strings into your latin1 database columns, then switching to a better
# programming language (like Ruby 1.9) may get you some weird results. MySQL
# will try to be helpful, and convert the stored bytes from latin1 to utf8. But
# since they're already in utf8, you get gobblidigook.
#
# Find more detail and a more complete description of the strategy used here at
---
# This playbook is an example for deploying multiple instances into EC2/Euca and "doing something" with them.
# - uses the ec2 and ec2_vol module.
#
# Run this with ansible-playbook and supply the private key for your EC2/Euca user (to access the instance in the second play), e.g:
# ansible-playbook eucalyptus-ec2-deploy.yml -v --private-key=/path/to/ec2/pri/key
- name: Set up a new ubuntu instance and register it in your ansible inventory file
hosts: local
connection: local
user: root
---
# Run this with ansible-playbook and supply the private key for your EC2/Euca
# user (to access the instance in the second play), e.g:
# ansible-playbook eucalyptus-ec2-deploy.yml -v --private-key=/path/to/ec2/pri/key
- name: Set up a new ubuntu instance and register it in your ansible inventory file
hosts: local
connection: local
user: root
gather_facts: false