Skip to content

Instantly share code, notes, and snippets.

View mkdynamic's full-sized avatar

Mark Dodwell mkdynamic

View GitHub Profile
@mkdynamic
mkdynamic / .irbrc.rb
Created August 19, 2010 20:10
my .irbrc file
# rubygems
require 'rubygems'
# active_support from rails
require 'active_support' unless ENV['RAILS_ENV']
# wirble -- colors + more
require 'wirble'
module Wirble::Colorize::Color
class << self
@mkdynamic
mkdynamic / bundles.sh
Created June 18, 2010 02:31
Install all of http://github.com/phuibonhoa's TM bundles (OS X only)
#!/usr/bin/env bash
#
# install all of http://github.com/phuibonhoa's TM bundles (OS X only)
#
echo "Installing bundles..."
# backup dir
if [ -d ~/desktop/_tm_bundle_backups ]; then rm -rf ~/desktop/_tm_bundle_backups; fi
context "#domain" do
should "return correct domain from given host" do
examples = {
"foo.bar.mydomain.com" => "mydomain.com",
"foo.bar.www.mydomain.com" => "www.mydomain.com",
"foo.bar.www.mydomain.co.uk" => "www.mydomain.co.uk",
"www.mydomain.com" => "www.mydomain.com",
"foo.mydomain.co.uk" => "mydomain.co.uk",
"foo.bar.www.my-domain.com" => "www.my-domain.com",
"foo.m.net" => "m.net",
/* the joy of browser standards... seriously, IE8 - why? */
.foo {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; /* IE 8 */
filter: alpha(opacity=50); /* IE 6 + 7 */
-khtml-opacity: 0.50; /* Safari < 1.2 (KHTML) */
-moz-opacity: 0.50; /* FF < 1.5, Mozilla <= 1.6 */
opacity: 0.50; /* FF 1.5+, Safari 1.2+, Opera 9+ (CSS3) */
}
@mkdynamic
mkdynamic / gist:198559
Created September 30, 2009 23:23
Paperclip, S3 & Delayed Job
#
# Add a :processing flag to our model
#
class AddProcessingToImages < ActiveRecord::Migration
def self.up
add_column :images, :processing, :boolean
end
def self.down
@mkdynamic
mkdynamic / gist:191916
Created September 23, 2009 10:54
Spit out gems.yml and .gems in root of Rails app
namespace :gems do
desc "Spit out gems.yml and .gems in root of app (for Heroku + EY etc.)"
task :specify => :environment do
gems = Rails.configuration.gems
# output gems.yml
yaml = File.join(RAILS_ROOT, "gems.yml")
File.open(yaml, "w") do |f|
output = []
gems.each do |gem|
@mkdynamic
mkdynamic / gist:109615
Created May 10, 2009 13:30
Abandon Cucumber for projects where *I am* the client!
require 'test_helper'
class SignupTest < ActionController::IntegrationTest
test "signing up" do
# Given there are X users
2.times { Factory(:user) }
users_count = User.count
# When I go to the signup page
@mkdynamic
mkdynamic / gist:109592
Created May 10, 2009 11:04
Remove .svn recursively from current directory
alias desvn='find . -name ".svn" -exec rm -rf {} \;'
@mkdynamic
mkdynamic / gist:109591
Created May 10, 2009 11:02
Shortcut for TextMate – open project file if exists, or just open the directory if not
mm(){
[ -f *.tmproj ] && open -a 'textmate' `ls -lG *.tmproj | awk '{print $9}'` || mate .
}
@mkdynamic
mkdynamic / gist:109589
Created May 10, 2009 11:01
Fix Safari 4 dubious UI decisions
shitari(){
defaults write com.apple.Safari DebugSafari4TabBarIsOnTop -bool NO
defaults write com.apple.Safari DebugSafari4IncludeToolbarRedesign -bool NO
defaults write com.apple.Safari DebugSafari4LoadProgressStyle -bool NO
echo 'Fixed.'
}