Skip to content

Instantly share code, notes, and snippets.

View mastfish's full-sized avatar

Justin Lambert mastfish

View GitHub Profile
@mastfish
mastfish / receive.rb
Created October 8, 2014 03:01
Setting up SNS and SQS
# Credentials
AWS.config(access_key_id: ENV['AWS_KEY_ID'], secret_access_key: ENV['AWS_ACCESS_KEY'])
# Get the queue
sqs = AWS::SQS.new
queue = sqs.queues.create('search-service-uat')
# This will run forever, listening for messages and processing them
queue.poll do |message|
event = Hashie::Mash.new(JSON.parse(message.body))
@mastfish
mastfish / playbook1.json
Created August 28, 2013 07:10
JSON spec
{
"playbook": {
"name": "{{lang 'name'}}",
"_id": "playbook1",
"language": {
"en-US": {
"name": "Marketing Playbook 1"
},
"phases": ["phase1", "phase2"],
"type": "playbook"
@mastfish
mastfish / application_controller.rb
Last active December 18, 2015 01:19
Strong parameters with devise
class ApplicationController < ActionController::Base
before_filter :define_resource_params, if: :devise_controller?
protected
def define_resource_params
if ((self.class <= Devise::PasswordsController) || (self.class <= Devise::RegistrationsController))
self.class.send(:define_method, :resource_params) do
params.require(resource_name).permit(:email, :password, :password_confirmation)
end