Skip to content

Instantly share code, notes, and snippets.

Lennart Fridén DevL

Block or report user

Report or block DevL

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DevL
DevL / generate_sequel_migration.rake
Created Dec 14, 2012
Generate a timestamped, empty Sequel migration in the 'migrations' directory.
View generate_sequel_migration.rake
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
end
content = "Sequel.migration do\n up do\n \n end\n\n down do\n \n end\nend\n"
timestamp = Time.now.to_i
@DevL
DevL / heroku_redis_cli.rake
Created Dec 12, 2012
Rake task for connecting to Redis on Heroku. Replace OPENREDIS_URL with whatever environment variable contains Redis connection string.
View heroku_redis_cli.rake
desc 'Connect to Redis (production)'
task :redis do
redis_uri = `heroku config:get OPENREDIS_URL`
pattern = /redis:\/\/:(\S+)@(\S+):(\d+)/
redis_uri[pattern]
command = "redis-cli -a #{$1} -h #{$2} -p #{$3}"
exec command
end
View sequel_migrations.rake
namespace :db do
require 'sequel'
namespace :migrate do
Sequel.extension :migration
task :connect do
if ENV['DATABASE_URL']
DB = Sequel.connect(ENV['DATABASE_URL'])
else
puts 'ABORTING: You must set the DATABASE_URL environment variable!'
@DevL
DevL / listjs_int_char_test.html
Created Dec 9, 2011
list.js international character test
View listjs_int_char_test.html
<!DOCTYPE html>
<html>
<head>
<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>
</head>
<body>
You can’t perform that action at this time.