Skip to content

Instantly share code, notes, and snippets.

Chris Eppstein chriseppstein

Block or report user

Report or block chriseppstein

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
View general.sass
// Clearing floats without extra markup
// Based on How To Clear Floats Without Structural Markup by PiE
// []
// From the official sass documentation.
display: inline-block
content: "."
display: block
height: 0
View sass_script_enhancements.sass
= spans(!columns)
- for !column from 1 through !columns by 2 // though = .., to = ..., by = incrementor
= span(!column, !columns)
:width= 45px * !column + 15px
- if !column != !columns
:margin-right 15px
View usage_example.rb
require 'ignoring_diff'
Hash.send(:include, IgnoringDiff)
h = {:foo => :bar}
# => {:foo => :bar}
# => {}
chriseppstein / tracer.rb
Created Aug 21, 2008
Trace method entrances and exists. Requires ActiveSupport.
View tracer.rb
module Tracer
def trace(method)
method, ending = split_method_name(method)
define_method "#{method}_with_trace#{ending}" do |*arguments|
puts "called #{self.class}##{method}#{ending}(#{', ')})"
returning(send("#{method}_without_trace#{ending}", *arguments)) do |v|
puts "#{self.class}##{method}#{ending} => #{v.inspect}"
alias_method_chain "#{method}#{ending}", :trace
View compass.css
.compass { margin: 1em auto; position: relative; width: 16em; height: 16em; font-size: 24px; font-family: "Academy Engraved LET", "Papyrus"; }
.compass .n, .compass .s, .compass .e, .compass .w { position: absolute; width: 4em; height: 4em; text-align: center; vertical-align: middle; }
.compass .w { left: 0px; }
.compass .n.w, .compass .s.w { left: 2em; }
.compass .n, .compass .s { left: 6em; }
.compass .n.e, .compass .s.e { left: 10em; }
.compass .e { left: 12em; }
.compass .n { top: 0px; }
.compass .n.w, .compass .n.e { top: 2em; }
.compass .w, .compass .e { top: 6em; }
View anonymizer.rb
module Anonymizer
def anonymize_attribute(attribute)
self.send(:include, do
define_method attribute do
a = @attributes[attribute.to_s]
a && attribute.to_s.ends_with?("_id") ? a.to_i : a
define_method "#{attribute}_with_anonymous" do
send("#{attribute}_without_anonymous") unless anonymous?
View content_for_helpers.rb
module ContentForHelpers
def content_for?(name, options = {}, &block)
has_content = (!instance_variable_get("@content_for_#{name}").strip.blank? rescue nil)
should_process = options[:negate] ? !has_content : has_content
if should_process && block_given?
concat(capture(&block), block.binding)
return should_process
View gist:13840
Display Name:
= h
= link_to "edit", edit_user_url(@user, :field => "name")
Your Email:
= h
= link_to "edit", edit_user_url(@user, :field => "email")
View Fixed-bug-in-compass-initializer-.patch
From e2a475f33f822d0f5810f26fcc9e562997358326 Mon Sep 17 00:00:00 2001
From: Chris Eppstein <>
Date: Fri, 3 Oct 2008 14:23:25 -0700
Subject: [PATCH] Fixed bug in compass initializer.
config/initializers/compass.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/config/initializers/compass.rb b/config/initializers/compass.rb
View commented.sass
This file is well documented with a silent comment that describes what it does.
In this comment we are testing mutli-line silent comments at the start of a document.
:margin 0
:font 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif
:color #fff
:background url(/images/global_bg.gif)
You can’t perform that action at this time.