Skip to content

Instantly share code, notes, and snippets.

View xwmx's full-sized avatar

William Melody xwmx

View GitHub Profile
@xwmx
xwmx / gist:28119
Created November 23, 2008 14:05
undefined
javascript:window.location=%22http://localhost/links/new?url=%22+encodeURIComponent(document.location)+%22&title=%22+encodeURIComponent(document.title)
namespace :sass do
desc 'Updates stylesheets if necessary from their Sass templates.'
task :update => :environment do
Sass::Plugin.update_stylesheets
end
end
@xwmx
xwmx / db.rake
Created November 23, 2008 12:31
namespace :db do
desc "Drop then recreate the dev database, migrate up, and load fixtures"
task :remigrate => :environment do
return unless %w[development test staging demo].include? Rails.env
ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }
Rake::Task["db:migrate"].invoke
ENV['FIXTURES_PATH'] = "db/data/#{RAILS_ENV}" unless (ENV['FIXTURES_PATH'] || Rails.env.test?)
Rake::Task["db:fixtures:load"].invoke
end
# http://fightingforalostcause.net/misc/2006/compare-email-regex.php
# email validation
/^[-_a-z0-9\'+*$^&%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+@(?:(?![-.])[-a-z0-9.]+(?<![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?$/iD