Skip to content

Instantly share code, notes, and snippets.

View robzolkos's full-sized avatar
📈
Building products

Rob Zolkos robzolkos

📈
Building products
View GitHub Profile
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'mysql2'
gem 'capistrano'
gem "haml"
gem "haml-rails"
gem "jquery-rails"
gem "hpricot"
gem "devise"
@robzolkos
robzolkos / org_spec.rb
Created May 19, 2011 02:17
spec for organisations, categories, products
it "association test should work for organisations, categories, products" do
@orga = Factory.create(:organisation, :id=>1, :title=>"abc")
@orgb = Factory.create(:organisation, :id=>2, :title=>"abc")
@cata = Factory.create(:category, :title=>"design")
@catb = Factory.create(:category, :title=>"web design")
@catc = Factory.build(:category, :title=>"web")
@product1 = Factory.create(:product, :id=>1, :title=>"xxx", :categories=>[@cata, @catb], :organisation=>@orga)
@product2 = Factory.create(:product, :id=>2, :title=>"yyy", :categories=>[@catc, @cata], :organisation=>@orga)
@robzolkos
robzolkos / prawn_error_image_cells.rb
Created November 7, 2011 03:20
Prawn error with image cells
@pdf = Prawn::Document.new(:margin=>0)
image = "#{Prawn::BASEDIR}/data/images/prawn.png"
@imgcell = Prawn::Table::Cell.make(@pdf, :image=>image)
ArgumentError: Content type not recognized: nil
from /Users/rzolkos/.rvm/gems/ruby-1.9.2-p180/gems/prawn-0.12.0/lib/prawn/table/cell.rb:127:in `make'
from (irb):6
from /Users/rzolkos/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'
@robzolkos
robzolkos / test.js.coffee
Created November 16, 2011 05:17
Coffeescript function
calcMenuPrice: ->
qty = $('#order_qty').val()
price = $('#order_qty option:selected').data("price")
amt = qty * price
ttl = '$' + amt.toFixed(2)
$('span.price').text(ttl)
jQuery ->
$('#order_qty').change ->
calcMenuPrice()
@robzolkos
robzolkos / development.log
Created November 21, 2011 01:48
Provider development log
Started GET "/auth/josh_id/authorize?response_type=code&client_id=YE0NYveQGoFsNLX220Dy5g&redirect_uri=http%3A%2F%2Flocalhost%3A3001%2Fauth%2Fjoshid%2Fcallback" for 127.0.0.1 at 2011-11-21 12:47:42 +1100
Processing by AuthController#authorize as HTML
Parameters: {"response_type"=>"code", "client_id"=>"YE0NYveQGoFsNLX220Dy5g", "redirect_uri"=>"http://localhost:3001/auth/joshid/callback"}
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
SQL (1.5ms) DELETE FROM "access_grants" WHERE (created_at < '2011-11-18 01:47:42.705591')
Client Load (0.6ms) SELECT "clients".* FROM "clients" WHERE "clients"."app_id" = 'YE0NYveQGoFsNLX220Dy5g' LIMIT 1
Binary data inserted for `string` type on column `access_token`
Binary data inserted for `string` type on column `code`
Binary data inserted for `string` type on column `refresh_token`
SQL (1.2ms) INSERT INTO "access_grants" ("access_token", "access_token_expires_at", "client_id", "code", "created_at", "refresh_token", "updated_at", "
@robzolkos
robzolkos / print function
Created November 24, 2011 02:36
Browser prints hidden elements
function printJobSheet() {
$('.historysection').hide();
$('.copy').hide();
window.print();
$('.copy').show();
$('.historysection').show();
return false;
}
@robzolkos
robzolkos / TechDecisions.md
Created November 28, 2011 13:38
Choices to make in a new Rails project. Would love to see this forked with other's opinions.

Team Support

Source Code Control

git (private server)
Alternative: github

Time Tracking

Cashboard

@robzolkos
robzolkos / application_controller.rb
Created December 30, 2011 00:05
custom user class to store user attributes retrieved from omniauth
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :login_required
helper_method :current_user
def current_ability
@current_ability ||= Ability.new(current_user)
end
@robzolkos
robzolkos / basicsetup
Created January 10, 2012 11:48 — forked from anathematic/Ruby on Rails server config.md
Quick notes for 1.9.2 + postgres on Ubuntu 10.4
sudo /usr/sbin/groupadd rvm
sudo /usr/sbin/usermod -G rvm ubuntu
sudo apt-get install git-core build-essential zlib1g-dev libssl-dev libreadline5-dev libxml2-dev libsqlite3-dev libxslt-dev libxml2-dev libcurl4-openssl-dev
sudo su -
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
rvm pkg install zlib
rvm remove 1.9.2
rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr
rvm use 1.9.2 --default
gem install bundler passenger
@robzolkos
robzolkos / accept_header_spec.rb
Created January 24, 2012 05:05
Integration test for accept header issue in Rails 3
require 'spec_helper'
describe "Returns page as normal" do
it "with accept header '*/*;q=0.6'" do
page.driver.header "Accept", "*/*;q=0.6"
visit fb_path
page.current_path.should == fb_path
end
it "with accept header 'text/html;q=0.7'" do