Skip to content

Instantly share code, notes, and snippets.

Build that!

David Gil dgilperez

Build that!
View GitHub Profile
View quickerclip.rb
module Paperclip
class Geometry
def self.from_file file
class Thumbnail
def make
src = Test::FileHelper.fixture_file('white_pixel.jpg')
dst =[@basename, @format].compact.join("."))
rgo / gist:1173243
Created Aug 26, 2011 — forked from diecrf/gist:1170410
Delete unused images in a rails project
View gist:1173243
images = Dir.glob('public/images/*')
images.each do |image|
puts "Checking #{image}..."
if IO.popen("ack-grep -1 -G '(app|public)' --ruby --html --css #{File.basename(image)}").eof?
IO.popen("svn delete #{image}")
puts " Deleted"
tddium / capybara_debug.rb
Created Nov 16, 2011
Trap Capybara Stack Trace
View capybara_debug.rb
### Show stack trace for 500 errors
### (adapted from
# Given an application, yield to a block to handle exceptions
class ExceptionRaiserApp
def initialize(app)
@app = app
def call(env)
bsodmike / gist:1698390
Created Jan 29, 2012
git diff between Rails 3.2.0 and Rails 3.1.0 generated apps
View gist:1698390
diff --git a/.gitignore b/.gitignore
index 923b697..eb3489a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,15 @@
chsh / appapp_delegate.rb
Created May 10, 2012
RubyMotion Localization sample.
View appapp_delegate.rb
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
alert =
alert.message = t('start')
def t(key)
NSBundle.mainBundle.localizedStringForKey(key, value:nil, table:nil)
ParkinT / uilabel_adjustable.rb
Created Jul 8, 2012
RubyMotion class to auto-size font for text in a multi-line UILabel
View uilabel_adjustable.rb
class UILabel_Adjustable
# Borrowed and modified the excellent example at
# adapting it for RubyMotion
# This applies only to a multi-line label. You can use '.adjustsFontSizeToFitWidth = true' for a single-line label
# usage is:
# text = "It's bad luck to be superstitious"
# text_label = UILabel.alloc.initWithFrame([[20, 20], [70, 120]])
# text_label.numberOfLines = 0 # set 0 for word wrap
# text_label.lineBreakMode = UILineBreakModeWordWrap
jrochkind / gist:4342817
Created Dec 20, 2012
Still SimpleDelegator based Decorator, but with an ActionView::Context view_context passed in too
View gist:4342817
require 'delegate'
class Base
def foo
def bar
felipeelias / spec_helper.rb
Last active Dec 10, 2015
Simple 'database cleaner' approach using `config.around`. Was able to cut down some seconds out of the suite. Thanks to @brandonhilkert
View spec_helper.rb
RSpec.configure do |config|
config.around do |example|
# For examples using capybara-webkit for example.
# Remove this if you don't use it or anything similar
if example.metadata[:js]
ActiveRecord::Base.connection.execute("TRUNCATE #{ActiveRecord::Base.connection.tables.join(',')} RESTART IDENTITY")
ActiveRecord::Base.transaction do
dhenze / bootstrap-typeahead.js
Created Jan 10, 2013
This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions. For example, process typeahead list asynchronously and return objects This is an adoption of gudburgurs gist to Version 2.2.2 of Bootstrap. See
View bootstrap-typeahead.js
/* =============================================================
* bootstrap-typeahead.js v2.2.2
* =============================================================
* Copyright 2012 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

Benchmark Bundler

Because loading gems can take longer than you think

Now available as a gem - get it here

You can’t perform that action at this time.