Skip to content

Instantly share code, notes, and snippets.

View theIV's full-sized avatar

Stewart Laufer theIV

View GitHub Profile
@theIV
theIV / .autotest
Created April 15, 2009 18:07 — forked from olauzon/.autotest
require 'autotest/redgreen'
# require 'autotest/pretty'
# require 'autotest/snarl'
# require 'autotest/timestamp'
module Autotest::Growl
def self.growl title, msg, img, pri=0, sticky=""
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}"
end
cd source
wget http://monkey.org/~provos/libevent-1.4.11-stable.tar.gz
tar -zxvvf libevent-1.4.11-stable.tar.gz
cd libevent-1.4.11-stable
./configure
make
sudo make install
cd ..
@theIV
theIV / gfm.rb
Created March 15, 2010 18:52 — forked from mojombo/gfm.rb
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end
→ terminitor start project
/Users/frecial/.rvm/gems/ruby-1.8.7-p174/gems/terminitor-0.1.0/lib/terminitor/cores/mac_core.rb:18:in `execute_command': undefined method `do_script' for nil:NilClass (NoMethodError)
from /Users/frecial/.rvm/gems/ruby-1.8.7-p174/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:34:in `run_in_window'
from /Users/frecial/.rvm/gems/ruby-1.8.7-p174/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:33:in `each'
from /Users/frecial/.rvm/gems/ruby-1.8.7-p174/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:33:in `run_in_window'
from /Users/frecial/.rvm/gems/ruby-1.8.7-p174/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:30:in `each_pair'
from /Users/frecial/.rvm/gems/ruby-1.8.7-p174/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:30:in `run_in_window'
from /Users/frecial/.rvm/gems/ruby-1.8.7-p174/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:21:in `process!'
from /Users/frecial/.rvm/gems/ruby-1.8.7-p174/gems/terminitor-0.1.0/lib/terminitor/runner.rb:
[color]
sh = auto
branch = auto
diff = auto
interactive = auto
status = auto
[core]
excludesfile = /Users/frecial/.gitignore
[user]
name = Stewart Laufer
@theIV
theIV / fuck-you-firefox.md
Created May 24, 2011 19:05
Firefox video.canPlayType awesomeness

Try your damndest to remember this.

At least when it comes to Firefox 4, the following are NOT equivalent, and will make calls to video.canPlayType to fail.

type="video/ogg; codecs='theora, vorbis'"

type='video/ogg; codecs="theora, vorbis"'

You want to use the second one.

@theIV
theIV / coupons
Created November 6, 2012 19:09 — forked from rapind/coupons
Load Groupon Codes into Shopify Discounts
# http://forums.shopify.com/categories/6/posts/42926
# This is a fairly simple mechanize script to create a few hundred or so shopify discounts from a CSV of groupon codes.
# You'll want to change all of the "changeme" values to your own.
# The script expects there to be a groupon_codes.csv in the same directory.
#
# The groupons_code.csv should look like this:
# 8m7677
# 8m6749
# 8m5398
# 8m7699
@theIV
theIV / data.txt
Created January 10, 2013 23:41
dat data
zip state long lat
00001 AK 123 456
00002 AK 234 678
@theIV
theIV / README.md
Last active December 14, 2015 03:39 — forked from ryanb/chef_solo_bootstrap.sh
# How to use Paperclip for generic attachment types on models in Ruby on Rails
class User < ActiveRecord::Base
has_many :user_assets
end
# example of building a model which is a generic attachment asset
@user.build_user_asset(:asset_type => "podcast", :attached_file => some_uploaded_file_data)
# make a generic asset class, with instances initialized for specific asset