Skip to content

Instantly share code, notes, and snippets.

def create
@user = User.new(user_params)
if @user.save
ExampleMailer.purchase_email(@user).deliver
ExampleMailer.sale_email(@user).deliver
begin
Rails.logger.error("STRIPE API KEY: #{Stripe.api_key.inspect}")
@amount = 999
customer = Stripe::Customer.create(
def create
@user = User.new(user_params)
if @user.save
ExampleMailer.purchase_email(@user).deliver
ExampleMailer.sale_email(@user).deliver
begin
Rails.logger.error("STRIPE API KEY: #{Stripe.api_key.inspect}")
@amount = 999
customer = Stripe::Customer.create(
# Throttled Input event
#
#= provides throttled:input
#
#= require jquery
#
# Delays firing `input` event until user is done typing.
#
# ### Events
#
@rfunduk
rfunduk / gist:3206815
Created July 30, 2012 13:18 — forked from avibryant/gist:3200554
The Regex Game
The Regex Game
Avi Bryant
This is a game for two programmers, although it's easy to imagine variations for more.
It can be played over email, twitter, or IM, but it's easy to imagine a custom web app for it, and I encourage someone to build one.
Each player starts by thinking of a regular expression. The players should decide beforehand on dialect and length restrictions (eg, has to be JavaScript-compatible and under 20 characters).
They don't reveal the Regex, but if playing over email etc, should send each other a difficult to brute force hash (eg bcrypt) of the Regex for later verification.
They do reveal two strings: one which the Regex will match, and one which it will not.
@rfunduk
rfunduk / osx.sh
Last active August 27, 2021 15:00 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with useful tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2263406/osx.sh | sh
#
@rfunduk
rfunduk / example_controller.rb
Created February 17, 2012 13:24 — forked from shime/example_controller.rb
sending errors to Exceptional with rescue_from
class ExampleController < ApplicationController
rescue_from Exception, :with => :render_custom
def render_custom(exception)
if Exceptional::Remote.error(Exceptional::ExceptionData.new(exception, "Test Exception"))
Rails.logger.info "Exceptional: #{exception.class} has been reported to Exceptional"
else
Rails.logger.error "Exceptional: Problem sending exception. Check your API key."
end