Skip to content

Instantly share code, notes, and snippets.


ara.t.howard ahoward

Block or report user

Report or block ahoward

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ahoward / imager.rb
Created Sep 5, 2012 — forked from tdreyno/imager.rb
Middleman Imager
View imager.rb
require 'base64'
require 'RMagick'
include Magick
module Imager
class << self
def registered(app)
app.send :include, InstanceMethods
app.ready do
ahoward / set_benchmark.rb
Created Aug 30, 2012 — forked from banker/set_benchmark.rb
Which of these is the fastest?
View set_benchmark.rb
x = 10000.times.to_a
a,b,c = x.dup, x.dup, x.dup
Benchmark.measure { 1000.times { out = []; out += a; out += b; out +=c; out.uniq! } }
Benchmark.measure { 1000.times { out =; out += a; out += b; out +=c; } }
Benchmark.measure { 1000.times { out = {}; a.each {|e| out[e] ||= 1}; b.each {|e| out[e] ||= 1}; c.each {|e| out[e] ||= 1}; } }
ahoward / gist:3515714
Created Aug 29, 2012 — forked from thomasmaas/gist:1013101
How to cache pages and clear them in Refinery CMS
View gist:3515714
# put in config/application.rb
config.to_prepare do
::PagesController.module_eval do
caches_page :show, :unless => proc {|c| c.user_signed_in? || c.flash.any? }
caches_page :home, :unless => proc {|c| c.user_signed_in? || c.flash.any? }
::Page.module_eval do
after_save :clear_static_caching!
after_destroy :clear_static_caching!
ahoward / gist:3423753
Created Aug 22, 2012
Everything you can override in a refinerycms project with refinerycms-blog
View gist:3423753
When starting a project that includes refinerycms-blog:
$ rake refinery:override view=refinery/pages/*
$ rake refinery:override view=layouts/*
$ rake refinery:override view=refinery/blog/shared/*
$ rake refinery:override view=refinery/blog/posts/*
$ rake refinery:override view=refinery/*
$ rake refinery:override controller=refinery/blog/*
$ rake refinery:override controller=refinery/*
ahoward / hashlike_bench.rb
Created Apr 7, 2012 — forked from copiousfreetime/hashlike_bench.rb
hash like comparison benchmark
View hashlike_bench.rb
#!/usr/bin/env ruby
require 'rubygems'
require "benchmark"
require 'map'
require 'digest/md5'
require 'hashr'
require 'hashie'
def keys( count, start = 'aaaaaa' )
ahoward / sequence.rb
Created Dec 29, 2011 — forked from durran/sequence.rb
Integer sequence ids in Mongo
View sequence.rb
require 'rubygems'
require 'mongoid'
Mongoid.configure do |config|
config.master ="test")
Mongoid.database.add_stored_function 'sequence', <<-__
function(sequence) {
View Rails MongoMapper Template.rb
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (
# To use:
# rails project_name -m
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
View scratch.rb
module Foo
def foo; end
class FooBar
include Foo
module Bar
def Bar.included(other)
You can’t perform that action at this time.