Skip to content

Instantly share code, notes, and snippets.

View seebq's full-sized avatar
💭
working on @Greenzie

Charles Brian Quinn seebq

💭
working on @Greenzie
View GitHub Profile
@seebq
seebq / gist:38110
Created December 19, 2008 20:34 — forked from anonymous/gist:38108
class User < ActiveRecord::Base
# Paperclip
has_attached_file :photo,
:styles => {
:thumb=> "100x100#",
:small => "150x150>",
:medium => "300x300>",
:large => "400x400>" }
@seebq
seebq / gist:670985
Created November 10, 2010 15:24 — forked from anonymous/gist:670982
class Widget < ActiveRecord::Base
AMERICAN_COLORS = %w(red white blue)
# /(red|white|blue)/i
validate :must_be_american
def must_be_american
unless AMERICAN_COLORS.include?(self.color.downcase)
errors.add(:color, " has to be american (#{AMERICAN_COLORS.to_sentence}, buddy....")
<% @body_onload = "initialize();" %>
<script type="text/javascript">
function initialize() {
// default to Atlanta
//custom styling variables
var stylez = [
{
Swarm3::Application.routes.draw do
devise_for :users
resources :swarm_requests do
put 'accept_requester_price_now', :on => :member
resources :bids do
put 'accept', :on => :member
end
class FalseClass
def affirmative?
false
end
end
class NilClass
def affirmative?
false
end
@seebq
seebq / api.rb
Created March 27, 2012 14:27 — forked from theinventor/api.rb
def unsubscribe
# using base64 encoding in the url to prevent unsubscribe abuse
@user = User.find_by_access_token(Base64.decode64(params[:token])) # find the user from the ID in url
if @user.opt_out!
redirect_to root_url, :notice => "We won't bug you with emails!" # give them a little notice that it worked
else
render :text => "Could not find your access token, did you copy-paste the correct email from the unsubscribe? Just email us at blah2blah.com"
end
end