Skip to content

Instantly share code, notes, and snippets.

View Kellyreid's full-sized avatar

Kelly B Reid Kellyreid

View GitHub Profile
@Kellyreid
Kellyreid / measurements_controller.rb
Created July 30, 2012 23:12
measurements_controller
class MeasurementsController < ApplicationController
before_filter :authenticate_user!
# GET /measurements
# GET /measurements.json
def index
@measurements = Measurement.all
respond_to do |format|
@Kellyreid
Kellyreid / measurements.rb
Created July 30, 2012 23:13
measurements model
class Measurement < ActiveRecord::Base
attr_accessible :bf, :created_on, :geo, :mass, :note, :user_id, :updated_on
belongs_to :user
validates :bf, :numericality => true
validates :mass, :numericality => true
end
@Kellyreid
Kellyreid / user.rb
Created July 30, 2012 23:13
user model
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
# attr_accessible :title, :body
class Ability
include CanCan::Ability
def initialize user, options = {}
if !user
can :read, :all
end
if user.has_role? :admin
can :manage, :all
@Kellyreid
Kellyreid / gist:3259539
Created August 4, 2012 19:43
measurements_controller.rb
class MeasurementsController < ApplicationController
before_filter :authenticate_user!
load_and_authorize_resource
# GET /measurements
# GET /measurements.json
def index
@measurements = Measurement.all
@Kellyreid
Kellyreid / orphan_tcg_names.yml
Created October 2, 2012 16:55
orphan tcg names
%YAML 1.1
---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<title>phpMyAdmin</title>
card kingdom builds their buy list using one big POST form. the fields are product_id, style and qty. each are an array starting at key 0.
http://www.cardkingdom.com/sellcart/add?product_id[0]=26268&style[0]=NM&qty[0]=22 will add 22 Near-Mint Imperial Recruiter to the buy list, EG.
Troll And Toad has an annoying AJAX thing going on which seems to be a bitch to work with. they also let the user download a csv
https://www.trollandtoad.com/secure/selling.php?Department=M&Format=CSV