Skip to content

Instantly share code, notes, and snippets.

View danielfone's full-sized avatar

Daniel Fone danielfone

View GitHub Profile
def post_process(*style_args) #:nodoc:
return if @queued_for_write[:original].nil?
catch :validation_failed do
instance.run_paperclip_callbacks(:post_process) do
instance.run_paperclip_callbacks(:"#{name}_post_process") do
throw :validation_failed if @options[:check_validity_before_processing] && instance.errors.any?
post_process_styles(*style_args)
end
end
@danielfone
danielfone / exist.rb
Created April 1, 2014 07:31
Memoized exist matcher
module RSpec
module Matchers
module BuiltIn
# @api private
# Provides the implementation for `exist`.
# Not intended to be instantiated directly.
class Exist < BaseMatcher
def initialize(*expected)
@expected = expected
end
#!/bin/bash
source .config
# Setup up master repo
# git clone --bare $TMP_REPO $MASTER_REPO
sudo -u git git daemon \
--verbose \
--enable=receive-pack \
//
//-- Create a subscriber
//
// POST /api/my-brand/subscribers
{
"subscriber": {
"name": "Test Subscriber",
"email": "test@example.com",
"subscribe": [
'my-list-1',
@danielfone
danielfone / nested.rb
Last active August 29, 2015 14:02
Iterate over multiple arrays
x_coords = [...]
y_coords = [...]
x_coords.each do |x|
y_coords.each do |y|
do_point x, y
end
end
@danielfone
danielfone / unindent.rb
Last active August 29, 2015 14:06 — forked from avdi/unindent.rb
TEXT = <<EOF
See, the interesting thing about this text
is that while it seems like the first line defines an indent
it's actually the last line which has the smallest indent
there are also some blank lines
both with and without extra spaces in them
and it just goes on and on
@danielfone
danielfone / unindent.rb
Last active August 29, 2015 14:06 — forked from avdi/unindent.rb
TEXT = <<EOF
See, the interesting thing about this text
is that while it seems like the first line defines an indent
it's actually the last line which has the smallest indent
there are also some blank lines
both with and without extra spaces in them
and it just goes on and on
@danielfone
danielfone / unindent.rb
Last active August 29, 2015 14:06 — forked from avdi/unindent.rb
TEXT = <<EOF
See, the interesting thing about this text
is that while it seems like the first line defines an indent
it's actually the last line which has the smallest indent
there are also some blank lines
both with and without extra spaces in them
and it just goes on and on
@danielfone
danielfone / unindent.rb
Last active August 29, 2015 14:06 — forked from avdi/unindent.rb
TEXT = <<EOF
See, the interesting thing about this text
is that while it seems like the first line defines an indent
it's actually the last line which has the smallest indent
there are also some blank lines
both with and without extra spaces in them
and it just goes on and on
@danielfone
danielfone / unindent.rb
Last active August 29, 2015 14:06 — forked from avdi/unindent.rb
TEXT = <<EOF
See, the interesting thing about this text
is that while it seems like the first line defines an indent
it's actually the last line which has the smallest indent
there are also some blank lines
both with and without extra spaces in them
and it just goes on and on