Skip to content

Instantly share code, notes, and snippets.

@boy-jer
boy-jer / tac.rb
Last active April 20, 2016 21:47
class Board
attr_reader :grid
def initialize(input_array_hash = {})
@grid = input_array_hash.fetch(:grid, board_default_grid)
end
def fetch_cell(x, y)
require 'minitest/autorun'
require_relative 'checkout'
class TestCheckoutTest < Minitest::Test
def setup
@checkout = Checkout.new('strawberry')
end
@boy-jer
boy-jer / credit_card_spec.md
Last active August 12, 2016 10:53
How I learned to love testing by Gregg Polack. https://www.youtube.com/watch?v=guSUuMMDl2E
@boy-jer
boy-jer / Rails Console Actionmailer test.rb
Created November 20, 2016 00:57 — forked from benoror/Rails Console Actionmailer test.rb
Rails Console Actionmailer test
# Copy and paste this to the rails console to test your email settings
class MyMailer < ActionMailer::Base
def test_email
set_tracking_headers 'test_campaign'
@recipients = "[email protected]"
@from = "Equipo Nimbo X <hola@" + Rails.application.secrets.sparkpost_domain + ">"
@subject = "sparkpost email test with open & click tracking"
@body = "This is a test email. With a <a href=\"http://blog.nimbo-x.com/nimbo-x-gold/\">test link</a>."
@boy-jer
boy-jer / contact.rb
Created March 21, 2021 23:03 — forked from endymion/contact.rb
Example of integrating a Ruby on Rails app with Zapier using the REST hooks pattern. With support for triggering the REST hooks from Resque background jobs.
class Contact < ActiveRecord::Base
...
def after_create
if Hook.hooks_exist?('new_contact', self)
Resque.enqueue(Hook, self.class.name, self.id)
# To trigger directly without Resque: Hook.trigger('new_contact', self)
end
end
#!/usr/bin/env ruby
require 'aws-sdk'
# initialize S3 client
s3_client = Aws::S3::Client.new(region: 'us-east-1')
# initialize KMS client
kms_client = Aws::KMS::Client.new(region: 'us-east-1')