Skip to content

Instantly share code, notes, and snippets.

View cherring's full-sized avatar
💭
Why do we even need this?

Chris Herring cherring

💭
Why do we even need this?
View GitHub Profile
@dmitry
dmitry / _search.html.haml
Created December 8, 2012 15:45
Custom filters/search in sidebar for active_admin using a partial
= form_for @search, url: collection_path,
as: :q,
builder: ActiveAdmin::Filters::CustomFormBuilder,
html: {method: :get, class: :filter_form} do |f|
= f.input :code_contains, as: :string
= f.input :code_contains, as: :filter_string
= f.form_buffers.last
@brianmcallister
brianmcallister / maintain-ratio.scss
Last active December 9, 2022 20:18
Sass mixin for a responsive box that maintains an aspect ratio.
// Maintain ratio mixin. Great for responsive grids, or videos.
// https://gist.github.com/brianmcallister/2932463
//
// $ratio - Ratio the element needs to maintain.
//
// Examples
//
// // A 16:9 ratio would look like this:
// .element {
// @include maintain-ratio(16 9);
@xaviershay
xaviershay / database_cache_store.rb
Created June 12, 2012 00:14
DatabaseCacheStore
# Implementation of Rails.cache backed by our database. We don't have high
# performance or space requirements, so using existing infrastructure for our
# caching needs is desirable.
class DatabaseCacheStore < ActiveSupport::Cache::Store
class CacheEntry < ActiveRecord::Base
end
def self.migrate_up(m)
m.create_table :cache_entries do |t|
t.string :key, :null => false
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@jacquescrocker
jacquescrocker / assets.yml
Created December 5, 2010 02:36
my barista config
# config/assets.yml
# I include these assets in my layout via jammit's helpers
# include_javascripts :all
# include_stylesheets :all
# learn more about jammit here: http://documentcloud.github.com/jammit/
compress_assets: off
package_path: "assets-compiled"
# Allow RSpec assertions over the elements of a collection. For example:
#
# collection.should all_be > 0
#
# will specify that each element of the collection should be greater
# than zero. Each element of the collection that fails the test will
# be reported in the error message.
#
# Examples:
# [1,1,1].should all_be eq(1)