This file contains hidden or 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
/* rules generated by blueprint typography mixin: */ | |
body { | |
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
color: #333333; | |
font-size: 75%; | |
background: #f9f9ee; | |
height: 100%; } | |
body h1 { | |
font-weight: normal; |
This file contains hidden or 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
class Role < ActiveRecord::Base | |
def self.[] (key) | |
find_by_name key.to_s | |
end | |
end | |
@user.role = Role['admin'] |
This file contains hidden or 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
ToadMate Bookmarklet | |
Adds clickable links to open the file/line from the | |
stacktrace on Hoptoad (http://hoptoadapp.com) into TextMate. | |
INSTALL: | |
Change the lpd variable to your local project directory. | |
It relies on your project folders being named after the main part | |
of your domain name (example.com => /example/). |
This file contains hidden or 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 ActionView | |
class ErSass < ActionView::TemplateHandler | |
include ERB::Util | |
SASS_ENGINE_OPTS = { | |
:load_paths => Compass.configuration.sass_load_paths + ["#{Rails.root}/app/stylesheets"] | |
} | |
def self.call(template) | |
"ActionView::ErSass.new(self).render(template, local_assigns)" |
This file contains hidden or 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
# Set up rendering of sass through ERB in ActionView | |
require 'ersass_template_handler' | |
ActionView::Template.register_template_handler :sass, ActionView::TemplateHandlers::ErSass | |
ActionView::Template.exempt_from_layout :sass |
This file contains hidden or 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
class ProductData < ActiveRecord::Base | |
belongs_to :product | |
def self.attribute_column_names | |
return @@attr_columns if defined?(@@attr_columns) | |
readers = content_columns.map { |n| n.name.intern } - [:created_at,:updated_at] | |
@@attr_columns ||= readers.map { |k| [k, "#{k}=".to_sym] }.flatten | |
end | |
end |
This file contains hidden or 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 File.dirname(__FILE__) + '/../test_helper' | |
require 'compass/test_case' | |
class StylesheetsTest < Compass::TestCase | |
class << self | |
def sass_files(path) | |
Dir.glob(File.join(path, "**", "[^_]*.sass")) | |
end | |
def test_stylesheet(sass_file, &block) |
This file contains hidden or 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
# Key bindings | |
# To see the key combo you want to use just do: | |
# $ read | |
# And press it | |
bind '"^[[D": backward-word' # option left | |
bind '"^[[C": forward-word' # option right |
This file contains hidden or 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 http://www.awayback.com/revised-font-stack/ | |
// | |
// Each stack has the survey statistics and any additional notes in '[]'. | |
// Stacks are ordered in Window > cross-platform > Mac | |
// | |
// Serif Font Stacks | |
// Cambria (54.51% on Windows) |
This file contains hidden or 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
# Before, I was overriding the initialize method to set the run_date. | |
# This is how I'm doing it now: | |
class ListingHighlight < ActiveRecord::Base | |
before_validation :assign_run_date | |
validates_presence_of :run_date, :on => :create | |
def run_date=( value ) | |
write_attribute :run_date, some_date_method(value) |
OlderNewer