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 'hoptoad_notifier/capistrano' | |
task :production do | |
set :rails_env, "production" | |
end | |
task :staging do | |
set :rails_env, "staging" | |
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
class Comment | |
include MongoMapper::Document | |
key :poll_id, Integer, :required => true, :index => true | |
key :name, String, :required => true | |
key :email, String, :required => true | |
key :body, String, :required => true | |
timestamps! | |
def poll |
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
# two-step processing of avatars. | |
class User < ActiveRecord::Base | |
has_attached_file :avatar, | |
:default_url => "/images/:attachment/:style-missing.gif", | |
:styles => { :medium => "200x200#", | |
:thumb => "55x55#" }, | |
:storage => 's3', | |
:s3_credentials => File.join(RAILS_ROOT, 'config', 'app_config.yml'), | |
:bucket => APP_CONFIG[:bucket], | |
:path => APP_CONFIG[:path], |
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
class TwitterSettingsController < ApplicationController | |
ssl_required :edit, :enable, :oauthorized | |
before_filter :require_user | |
def edit | |
end | |
def enable | |
@request_token = oauth_consumer.get_request_token(:oauth_callback => oauthorized_twitter_url) | |
session[:oauth_token] = @request_token.token |
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
class LabeledFormBuilder < ActionView::Helpers::FormBuilder | |
%w[text_field password_field select file_field text_area].each do |method_name| | |
define_method(method_name) do |field_name, *args| | |
content = '' | |
error = object.errors.on(field_name) | |
row_classes = 'form-row' | |
row_classes += ' error' unless error.blank? | |
label_classes = 'form-label' | |
label_classes += ' align' if %w|file_field select|.include?(method_name) | |
content += @template.content_tag(:div, :class => row_classes) do |
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
# since there is no deb package for Ubuntu 8.04 LTS, this is what I had to do | |
# download latest stable version of mongodb and move to /usr/local/mongodb | |
# add "export PATH=$PATH:/usr/local/mongodb/bin" to /etc/profile | |
# make directories for the data /db/mongodb/master and /db/mongodb/slave | |
# chown those directories to the user you want | |
# move this script to /etc/init.d/mongodb | |
# chmod +x /etc/init.d/mongodb | |
# update-rc.d mongodb defaults | |
RETVAL=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
<h2>Who We Are</h2> | |
<p>Hi! I am <a href="/r38y">Randy</a> and this is <a href="/tikaro">John</a>. We are the creators of Lose It or Lose It! We're overweight and don't want to be anymore!</p> | |
<h2>Why We Created Lose It or Lose It</h2> | |
<p>Let me (Randy) start with a little bit of my history. I think many of you will find it a familiar story.</p> | |
<p>In 1999 - 2000, I was a senior in high school and I weighed 245 lb. I have been overweight for as long as I can remember, but this is the first weight I can actually remember. I wanted to fix it, but I don't remember really trying that hard.</p> | |
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
# Macros I use for testing refraction redirections. It can be used thusly: | |
# it_should_permanently_redirect('http://loseitorloseit.test/stats', 'http://loseitorloseit.test/people') | |
# it_should_temporarily_redirect('http://loseitorloseit.test/stats', 'http://loseitorloseit.test/people') | |
module RewriteMacro | |
module ExampleGroupMethods | |
def it_should_permanently_redirect(start_point, end_point) | |
it "should permanently redirect #{start_point} to #{end_point}" do | |
env = Rack::MockRequest.env_for(start_point, :method => 'get') | |
app = mock('app') |
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 bb2a78858cffa7c6937642986e9aca1a4f862c0d Mon Sep 17 00:00:00 2001 | |
From: Ilya Grigorik <[email protected]> | |
Date: Thu, 10 Jun 2010 00:46:48 -0400 | |
Subject: [PATCH] async rails3 | |
--- | |
Gemfile | 6 ++++++ | |
app/controllers/widgets_controller.rb | 6 ++++++ | |
app/models/widget.rb | 2 ++ | |
config.ru | 1 + |
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
StoriesController#manage (NameError) "`@ge der' is not allowed as an instance variable name" | |
/usr/lib/ruby/gems/1.8/gems/mongo_mapper-0.8.2/lib/mongo_mapper/plugins/keys.rb:290:in `instance_variable_get' | |
/usr/lib/ruby/gems/1.8/gems/mongo_mapper-0.8.2/lib/mongo_mapper/plugins/keys.rb:290:in `read_key' | |
/usr/lib/ruby/gems/1.8/gems/mongo_mapper-0.8.2/lib/mongo_mapper/plugins/keys.rb:233:in `[]' | |
/usr/lib/ruby/gems/1.8/gems/mongo_mapper-0.8.2/lib/mongo_mapper/plugins/keys.rb:189:in `to_mongo' | |
/usr/lib/ruby/gems/1.8/gems/mongo_mapper-0.8.2/lib/mongo_mapper/plugins/keys.rb:188:in `each_pair' | |
/usr/lib/ruby/gems/1.8/gems/mongo_mapper-0.8.2/lib/mongo_mapper/plugins/keys.rb:188:in `to_mongo' | |
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/object/misc.rb:54:in `tap' | |
/usr/lib/ruby/gems/1.8/gems/mongo_mapper-0.8.2/lib/mongo_mapper/plugins/keys.rb:187:in `to_mongo' |