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
def to_json(options = {}) | |
options[:methods] ||= :file_path | |
options[:only] ||= [:id, :created_at, :caption] | |
super(options) | |
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
The idea seems to be that if INDenver Times becomes a big enough part of readers' lives, they'll be willing to pay for it down the line, instead of simply moving on to other free products. | |
(via http://blogs.westword.com/latestword/2009/04/indenver_times_kevin_preblud_s.php) |
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
# Displays the 21 most-recent galleries. | |
def index | |
@galleries = Gallery.paginate( | |
:order => "galleries.created_at DESC", | |
:include => [:sitings], | |
:conditions => "sitings.site_id = 1 and status not in ('hidden', 'deactivated')", | |
:page => page, | |
:per_page => 21 | |
) | |
@title = "Galleries" |
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
# A paginated list of recently-added photos | |
def index | |
@photos = Photo.paginate( | |
:per_page => 36, | |
:page => page, | |
:order => "photos.created_at DESC" | |
) | |
respond_to do |format| | |
format.html { | |
render :action => "list" |
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 'digest/md5' | |
class GeoUtil | |
COMMON_PLACE_SUFFIXES = [ | |
'[sS]treet', | |
'[sS]t\.', | |
'[aA]ve\.?', | |
'[aA]venue', | |
'[dD]r\.?', | |
'[dD]rive', |
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
def self.find_popular(args = {}) | |
find(:all, :select => 'tags.*, count(*) as popularity', | |
:limit => args[:limit] || 10, | |
:joins => "JOIN taggings ON taggings.tag_id = tags.id JOIN things on taggings.taggable_id = things.id", | |
:conditions => args[:conditions], | |
:group => "taggings.tag_id", | |
:order => "popularity DESC" ) | |
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
@search.all.group_by{|u| u.shipping_state}.reject{|i| i[0].blank?} | |
warning: multiple values for a block parameter (2 for 1) | |
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/ordered_hash.rb:63 |
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
def self.bulk_update(ids, *args) | |
set = sanitize_sql_hash_for_assignment(args.extract_options!) | |
connection.execute("UPDATE #{self.table_name} SET #{set} WHERE id in (#{ids.join(",")})") | |
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
subject: "acct:dummied@gmail.com" | |
aliases: "http://www.google.com/profiles/dummied" | |
links { | |
rel: "http://portablecontacts.net/spec/1.0" | |
href: "http://www-opensocial.googleusercontent.com/api/people/" | |
} | |
links { | |
rel: "http://webfinger.net/rel/profile-page" | |
type: "text/html" | |
href: "http://www.google.com/profiles/dummied" |
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
<?xml version='1.0' encoding='UTF-8'?> | |
<!-- Please follow the list at http://groups.google.com/group/webfinger --> | |
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0' | |
xmlns:hm='http://host-meta.net/xrd/1.0'> | |
<hm:Host xmlns='http://host-meta.net/xrd/1.0'>chrisvannoy.com</hm:Host> | |
<Link rel='lrdd' | |
template='http://chrisvannoy.com/webfinger/{uri}'> | |
<Title>Resource Descriptor</Title> | |
</Link> | |
</XRD> |
OlderNewer