Skip to content

Instantly share code, notes, and snippets.

View qrush's full-sized avatar
🕸️
Making internets

Nick Quaranto qrush

🕸️
Making internets
View GitHub Profile
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
# Works fine!
class User < ActiveRecord::Base
has_many :issued_tickets, :class_name => 'Ticket', :foreign_key => :issuer_id
end
# Failboat!
class User < ActiveRecord::Base
has_many :issued_tickets, :class_name => Ticket, :foreign_key => :issuer_id
end
has_attached_file :avatar,
:styles => { :medium => "200x600>", :thumb => "50x50", :small => "32x32" },
:default_url => "/images/missing/avatars/:style.png"
$(document).ready(function()
{
$('.polaroids .post').click(function()
{
window.location = $(this).children('a:first').attr('href');
});
});
require 'htmlentities'
class String
def slugify
self.gsub(/[^a-z0-9]+/i, '-').chomp('-')
end
def decode
HTMLEntities.new.decode(self)
end
class StatusReminder
class << self
def send_reminders
offset = 0
jump = 100
while( users = User.eligible_for_status_reminder(offset, jump) && !users.empty? )
users.each do |user|
logger.info("StatusReminder: Reminding #{user}")
describe MakesController do
fixtures :users
integrate_views
describe "index should be visible to" do
# this is a macro that just pumps out three tests: log in anonymous, log in as a user, log in as an admin
it_should_behave_like "check all users"
before do
# If you ever needed an array of all models in your Rails app (+ Session)
Dir.glob("app/models/*.rb").each{|r| require r}; subclasses_of(ActiveRecord::Base).map{|c| c.class_name}
Given /I am on the new make page/ do
visits new_make_url
end
Then /a new make called "(\w+)" should be created/ do |name|
Make.exists?(:name => name).should be_true
end
Given /I am on the edit make page for "(\w+)"/ do |name|
@id = Make.find_by_name(name).id
visits edit_make_url(@id)
end
When /its name should be updated to "(\w+)"/ do |name|
Make.find(@id).name.should == name
end