Skip to content

Instantly share code, notes, and snippets.

@kamui
kamui / textmate.crontab
Created August 21, 2010 02:15
cron commands to autoupdate textmate bundles
find ~/"Library/Application Support/TextMate/Bundles/" -name .git -execdir git pull --quiet \;
find ~/"Library/Application Support/TextMate/Bundles/" -maxdepth 2 -name .svn -execdir svn up --quiet \;
@kamui
kamui / dropbox-sync.sh
Created August 21, 2010 02:18
Mac use Dropbox Application Support
cd ~
rm -f .profile
ln -s ~/Dropbox/dotfiles/.profile .profile
rm -f .profile
ln -s ~/Dropbox/dotfiles/.zshrc .zshrc
rm -f .gitconfig
ln -s ~/Dropbox/dotfiles/.gitconfig .gitconfig
@kamui
kamui / move_to_dropbox.sh
Created August 21, 2010 02:35
Move Mac application preferences to Dropbox
cd ~
mkdir -p ~/Dropbox/dotfiles/
# dotfiles
mv .profile ~/Dropbox/dotfiles/
ln -s ~/Dropbox/dotfiles/.profile .profile
mv .zshrc ~/Dropbox/dotfiles/
ln -s ~/Dropbox/dotfiles/.zshrc .zshrc
@kamui
kamui / imagesQueue.js
Created November 26, 2010 10:12
http://labs.lieldulev.com/imagesQueue/ added a list called errorImages array, and use the onerror callback to add those images to the errorImages array. Both onerror and onload check the length of the images array against the queue + errorImages and calls
/*
imagesQueue.js FULL SOURCE
A simple, cross-browser, *parallel* images loader object.
Check http://labs.lieldulev.com/imagesQueue/ for more details.
*/
imagesQ={
onComplete: function(){} // Fires when all finished loading
,onLoaded: function(){} // Fires when an image finishes loading
,onErrored: function(){} // Fires when an image fails to load
,current: null // Last loaded image (Image Object)
@kamui
kamui / annotate_image.rb
Created March 22, 2011 16:42
Annotate text that auto fits within an image and benchmark on both graphicsmagick and imagemagick. Uses mini_magick
#!/usr/bin/env ruby
# Convert command line
#
#gm convert -font helvetica -fill white -pointsize 20 -draw "text 500,600 'WALLPAPERZ ARE GOOD'" test.jpg output.jpg
#
#convert -background transparent -fill white -gravity center -size 1024x200 -font Helvetica -pointsize 20 #caption:"I'm a wallpaper, you know what to do" test.jpg +swap -gravity south -composite output.jpg
#
# Mogrify command line
#
require 'posterous'
require 'time'
# Add your credentials Here
Posterous.config = {
'username' => '<email-address>',
'password' => '<password>',
'api_token' => '<api-token>'
}
@kamui
kamui / bundler_issue1937.md
Created May 21, 2012 20:44
bundler issue #1937

I was running guard and here's the specific backtrace, although it might not help since it's specific to my testing setup:

Running: test/functional/signups_controller_test.rb
/Users/JackC/.rvm/gems/ruby-1.9.3-p194@kickpuncher/gems/minitest-3.0.0/lib/minitest/spec.rb:68:in `describe': undefined method `create' for ActionController::TestCase:Class (NoMethodError)
	from /Users/JackC/Development/kickpuncher/test/functional/signups_controller_test.rb:3:in `<top (required)>'
	from -e:in `require'

Gemfile:

@kamui
kamui / nested_attributes_validation.rb
Created June 28, 2012 23:57
nested_attributes in a one_to_many relationship with a presence validation on the parent model
require 'sequel'
require 'sqlite3'
require 'logger'
require 'pry'
DB = Sequel.sqlite
DB.loggers << Logger.new($stdout)
Sequel::Model.plugin :validation_helpers
@kamui
kamui / nested_attributes_many_to_one_validation.rb
Created July 19, 2012 20:07
nested_attributes and many_to_one relationship validation
require 'sequel'
require 'sqlite3'
require 'logger'
DB = Sequel.sqlite
# DB.loggers << Logger.new($stdout)
Sequel::Model.plugin :validation_helpers
Sequel::Model.raise_on_save_failure = false
@kamui
kamui / restrictedcolumn.rb
Created August 14, 2012 22:13
/gems/sequel-3.38.0/lib/sequel/model/base.rb:1756:in `block in set_restricted': shopper is a restricted column (Sequel::Error)
# You just need sequel, fabrication, ffaker, and sqlite3 gems
require 'sequel'
require 'sqlite3'
require 'logger'
require 'fabrication'
require 'ffaker'
DB = Sequel.sqlite
# DB.loggers << Logger.new($stdout)