This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Clearing floats without extra markup | |
// Based on How To Clear Floats Without Structural Markup by PiE | |
// [http://www.positioniseverything.net/easyclearing.html] | |
// From the official sass documentation. | |
=clearfix | |
display: inline-block | |
&:after | |
content: "." | |
display: block | |
height: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= spans(!columns) | |
- for !column from 1 through !columns by 2 // though = .., to = ..., by = incrementor | |
+span(!column,!columns) | |
= span(!column, !columns) | |
.span-#{!column} | |
:width= 45px * !column + 15px | |
- if !column != !columns | |
:margin-right 15px | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ignoring_diff' | |
Hash.send(:include, IgnoringDiff) | |
h = {:foo => :bar} | |
h.diff({}) | |
# => {:foo => :bar} | |
h.ignore_difference_for(:foo) | |
h.diff({}) | |
# => {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}(#{arguments.map(&:inspect).join(', ')})" | |
returning(send("#{method}_without_trace#{ending}", *arguments)) do |v| | |
puts "#{self.class}##{method}#{ending} => #{v.inspect}" | |
end | |
end | |
alias_method_chain "#{method}#{ending}", :trace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Anonymizer | |
def anonymize_attribute(attribute) | |
self.send(:include, Module.new do | |
define_method attribute do | |
a = @attributes[attribute.to_s] | |
a && attribute.to_s.ends_with?("_id") ? a.to_i : a | |
end | |
define_method "#{attribute}_with_anonymous" do | |
send("#{attribute}_without_anonymous") unless anonymous? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
end | |
return should_process | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.field | |
Display Name: | |
= h @user.name | |
= link_to "edit", edit_user_url(@user, :field => "name") | |
.field | |
Your Email: | |
= h @user.email | |
= link_to "edit", edit_user_url(@user, :field => "email") | |
.field | |
Password: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e2a475f33f822d0f5810f26fcc9e562997358326 Mon Sep 17 00:00:00 2001 | |
From: Chris Eppstein <[email protected]> | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
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. | |
body | |
:margin 0 | |
:font 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif | |
:color #fff | |
:background url(/images/global_bg.gif) |
OlderNewer