Skip to content

Instantly share code, notes, and snippets.

View tsmango's full-sized avatar

Tom Mango tsmango

View GitHub Profile
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(function() {
$j('#sidebar-products-group a').each(function() {
if($j(this).text().substring(0, 4) == 'ALL:') {
$j(this).css('fontWeight', 'bold');
} else if($j(this).text() == 'All Categories') {
$j('#sidebar-products-group .body').append($j(this).clone().text('View All Products'));
def define_model_callbacks(*callbacks)
options = callbacks.extract_options!
options = {
:terminator => "result == false",
:scope => [:kind, :name],
:only => [:before, :around, :after]
}.merge(options)
types = Array.wrap(options.delete(:only))
def self.extended(base)
base.class_eval do
include ActiveSupport::Callbacks
end
end
>> category = Category.create(:name => 'Vinyl Records')
=> #<Category id: 1, name: "Vinyl Records", created_at: "2011-08-03 15:46:11", updated_at: "2011-08-03 15:46:11">
?> category.settings
=> #<ActiveConfiguration::SettingManager:0x10e7d1950 @configurable=#<Category id: 1, name: "Vinyl Records", created_at: "2011-08-03 15:46:11", updated_at: "2011-08-03 15:46:11">>
?> category.settings[:sort]
=> {:value=>"alphabetical", :modifier=>nil}
?> category.settings[:sort][:value]
class Category < ActiveRecord::Base
configure do
option :sort do
default 'alphabetical'
restrict 'alphabetical', 'manual'
end
option :limit do
format 'fixnum'
end
class Category < ActiveRecord::Base
configure do
option :sort do
default 'alphabetical'
restrict 'alphabetical', 'manual'
end
option :limit do
format 'fixnum'
end
{% flickr_set tsmango 72157625102245887 %}
---
layout: post
title: "How I Keep Limited Pressing Running"
alias: /post/6301645915/how-i-keep-limited-pressing-running/index.html
---
ActionController::Base.wrap_parameters :format => [:json]
Comment.find(:all, :conditions => ['thread_id IN (?)', ['2A', '2B', '2C']])