Skip to content

Instantly share code, notes, and snippets.

require 'posterous'
require 'time'
# Add your credentials Here
Posterous.config = {
'username' => '<email-address>',
'password' => '<password>',
'api_token' => '<api-token>'
}
@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
#
@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 / 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 / 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 / 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 \;