Skip to content

Instantly share code, notes, and snippets.

View Empact's full-sized avatar

Benjamin Woosley Empact

View GitHub Profile
@Empact
Empact / load_spec.rb
Created October 17, 2009 14:41 — forked from yob/gist:212242
[~/Projects/OpenSource/roxml (master)⚡] $ ruby spec/load_spec.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- roxml (LoadError)
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from spec/load_spec.rb:2
[~/Projects/OpenSource/roxml (master)⚡] $ sudo gem install pkg/roxml-3.1.0.gem
Password:
Successfully installed roxml-3.1.0
1 gem installed
Installing ri documentation for roxml-3.1.0...
Installing RDoc documentation for roxml-3.1.0...
# Filename: RAILS_ROOT/lib/paperclip_processors/thumbnail_with_dimensions.rb
# Required Configuration in the model
# has_attached_file :image,
# :styles => {
# :thumbnail => {
# :geometry => "100x100>",
# :format => :png,
# :processors => [:thumbnail_with_dimensions],
# :mystyle => :thumbnail
# },
@Empact
Empact / has_counter_cache_on.rb
Created June 14, 2011 10:22
has_counter_cache_on is a simple ActiveRecord extension which allows you to have multiple counters for a single association, counted when simple conditions are met
# has_counter_cache_on is a simple ActiveRecord extension
# which allows you to have multiple counters for a single
# association, counted when simple conditions are met
#
# The implementation is adapted from the current
# add_counter_cache_callbacks code in Rails.
#
# Example:
#
# class Submission < ActiveRecord::Base

Creative and Technical Services Agreement

This CREATIVE AND TECHNICAL SERVICES AGREEMENT (“Agreement”) is an agreement between Joshua Priddle, (“Developer”) and the party set forth in the Project Estimate (“Customer” or “you” or “your”) incorporated herein by this reference and applies to the purchase of all services ordered by Customer (collectively, the “Services”). The parties understand, acknowledge and agree that this is an online agreement which is being entered into in conjunction with the Services.

# an example Monit configuration file for delayed_job
#
# To use:
# 1. copy to /var/www/apps/{app_name}/shared/delayed_job.monitrc
# 2. replace {app_name} and {environment} as appropriate
# 3. add this to your /etc/monit/monitrc
#
# include /var/www/apps/{app_name}/shared/delayed_job.monitrc
check process delayed_job with pidfile /var/www/apps/{app_name}/shared/pids/delayed_job.pid
@Empact
Empact / delayed_job.monitrc.example
Created February 10, 2012 10:39 — forked from johankok/delayed_job.monitrc.example
Monitoring delayed_job with monit under rvm
# an example Monit configuration file for delayed_job
#
# To use:
# 1. copy to /var/www/apps/{app_name}/shared/delayed_job.monitrc
# 2. replace {app_name} and {environment} as appropriate
# 3. add this to your /etc/monit/monitrc
#
# include /var/www/apps/{app_name}/shared/delayed_job.monitrc
check process delayed_job with pidfile /var/www/apps/{app_name}/shared/pids/delayed_job.pid
@Empact
Empact / callback_disabler.rb
Created March 23, 2012 05:51 — forked from justinko/callback_disabler.rb
Disable raw filter callbacks in RSpec
# In spec/support/callback_disabler.rb
module CallbackDisabler
def self.store_callbacks(model, filters)
model = constantize(model)
filters.each do |filter|
model.send("_#{filter}_callbacks").each do |callback|
stored_callbacks[model] << {
filter: filter, kind: callback.kind, raw_filter: callback.raw_filter
}
@Empact
Empact / README.markdown
Created April 3, 2012 08:15 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
gem 'rails', '3.2.13'
require 'active_record'
puts "Active Record #{ActiveRecord::VERSION::STRING}"
ActiveRecord::Base.establish_connection(
adapter: 'sqlite3',
database: ':memory:'
)
gem 'rails', '3.2.13'
require 'active_record'
puts "Active Record #{ActiveRecord::VERSION::STRING}"
ActiveRecord::Base.establish_connection(
adapter: 'sqlite3',
database: ':memory:'
)