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 'rubygems' | |
require 'mechanize' | |
a = Mechanize.new { |agent| | |
agent.follow_meta_refresh = true | |
agent.pluggable_parser.pdf = Mechanize::FileSaver | |
} | |
a.get('https://manage.slicehost.com/') do |home_page| | |
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
Process: Safari [5047] | |
Path: /Applications/Safari.app/Contents/MacOS/Safari | |
Identifier: com.apple.Safari | |
Version: 5.0.5 (6533.21.1) | |
Build Info: WebBrowser-75332101~6 | |
Code Type: X86-64 (Native) | |
Parent Process: launchd [641] | |
Date/Time: 2011-06-29 21:14:22.609 -0700 | |
OS Version: Mac OS X 10.6.8 (10K540) |
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
def self.authenticate(email, password) | |
user = find(:first, :conditions => ['LOWER(username) = ? OR email = ?', email.to_s.downcase, email.to_s.downcase]) | |
user && user.authenticated?(password) ? user : nil | |
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
# MODEL | |
class Theater | |
named_scope :with_recent_comments, | |
:select => "*, recent_comments.created_at AS last_comment_at", | |
:joins => "INNER JOIN (SELECT * FROM comments WHERE entity_type = 'Theater' ORDER by id DESC LIMIT 100) | |
AS recent_comments ON recent_comments.entity_id = theaters.id", | |
:order => "recent_comments.created_at DESC" | |
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
# CONTROLLER | |
# Recent comments on theaters | |
comments = Comment.find(:all, :conditions => "entity_type = 'Theater'", :order => "id DESC", :select => "entity_id", :limit => 100) | |
comments = comments.map{ |i| i.entity_id }.uniq | |
theaters = Theater.find(:all, :conditions => "id IN (#{comments.join(',')})") | |
@theaters_with_comments = theaters.sort_by{|e| comments.index(e.id)} | |
# VIEW |
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
NEW | |
- Added rating stars to product grid | |
- Supports multiple sizes | |
- Displays half-step stars by default | |
- Improved styles on product, production association, and collections pages | |
- Improved styles on friends sidebar on Dashboard page | |
- Added basic tooltip support |
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
# Simple batch convertor for ERB => HAML | |
# To run, move to app root and do 'ruby haml.rb' | |
class ToHaml | |
def initialize(path) | |
@path = path | |
end | |
def convert! | |
Dir["#{@path}/**/*.erb"].each do |file| |
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
.message_block { | |
clear: both; | |
margin: 12px 0; | |
} | |
.message_block ul { | |
border-bottom: 1px solid #ecd757; | |
border-top: 1px solid #ecd757; | |
list-style: none; | |
padding: 10px; |
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
# Clear logs when booting server locally | |
# so they don't grow to be 1GB in size | |
if RAILS_ENV == 'development' | |
f = File.open("#{RAILS_ROOT}/log/development.log", "w") | |
f.close | |
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
var functions = [] | |
$.getJSON("/functions.json", function(data) { | |
$.each(data, function(i, item) { | |
functions.push(item.function.name); | |
}); | |
$("#functions_list").autocomplete(functions); | |
}); |