Skip to content

Instantly share code, notes, and snippets.

View DevL's full-sized avatar

Lennart Fridén DevL

View GitHub Profile
DevL / generate_sequel_migration.rake
Created December 14, 2012 14:48
Generate a timestamped, empty Sequel migration in the 'migrations' directory.
namespace :generate do
desc 'Generate a timestamped, empty Sequel migration.'
task :migration, :name do |_, args|
if args[:name].nil?
puts 'You must specify a migration name (e.g. rake generate:migration[create_events])!'
exit false
content = "Sequel.migration do\n up do\n \n end\n\n down do\n \n end\nend\n"
timestamp =
DevL / heroku_redis_cli.rake
Created December 12, 2012 12:59
Rake task for connecting to Redis on Heroku. Replace OPENREDIS_URL with whatever environment variable contains Redis connection string.
desc 'Connect to Redis (production)'
task :redis do
redis_uri = `heroku config:get OPENREDIS_URL`
pattern = /redis:\/\/:(\S+)@(\S+):(\d+)/
command = "redis-cli -a #{$1} -h #{$2} -p #{$3}"
exec command
DevL / sequel_migrations.rake
Created December 12, 2012 10:11
Sequel migration rake tasks based on
namespace :db do
require 'sequel'
namespace :migrate do
Sequel.extension :migration
task :connect do
DB = Sequel.connect(ENV['DATABASE_URL'])
puts 'ABORTING: You must set the DATABASE_URL environment variable!'
DevL / listjs_int_char_test.html
Created December 9, 2011 23:10
list.js international character test
<!DOCTYPE html>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>list.js international characters test</title>
<script type="text/javascript" src="list.min.js"></script>