Skip to content

Instantly share code, notes, and snippets.

@samsworldofno
samsworldofno / Gemfile
Last active August 29, 2015 14:03
Simple pub/sub and fanout examples
source 'https://rubygems.org'
gem 'aws-sdk'
gem 'yaml_properties'
gem 'pry'
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
'([\?\&][\\\/;&a-z\\d%_.~+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator
function testString(str){
if(!pattern.test(str)) {
return false;
@samsworldofno
samsworldofno / broadcast_flow_v1_decorator.rb
Created August 26, 2012 20:07
Continuous Deployment / Rollout Gem Code Examples
module BroadcastFlow
class V1Decorator < ApplicationDecorator
def navigation_partial
h.render 'events_wizard/wizard_steps'
end
def show_path
h.events_wizard_path(model)
end
end
@samsworldofno
samsworldofno / gist:535038
Created August 18, 2010 15:04
cap db:pull
namespace :db do
desc "Download the a full dump of the production database into the development database"
task :pull do
config = YAML::load(File.open(File.join('config', 'database.yml')))
dump_database_remotely(config['production'], remote_file)
compress_backup_remotely(remote_file)
download_backup(remote_file(:compressed), local_file(:compressed))