Skip to content

Instantly share code, notes, and snippets.

View cpjolicoeur's full-sized avatar

Craig P Jolicoeur cpjolicoeur

View GitHub Profile
before(:each) do
controller.should_receive(:check_authorization).and_return(true)
end
validates_presence_of :home_site, :unless => Proc.new { |u| u.superuser? }
##
SUPERUSER = 1
ADMIN = 2
MANAGER = 3
ATTENDANT = 4
DEFAULT_ROLE = ATTENDANT
ROLES = [ SUPERUSER, ADMIN, MANAGER, ATTENDANT ]
## FORM
- form_for @user, :html => { :multipart => true } do |f|
...
%p
= f.file_field :avatar
## MODEL
<script type="text/javascript" charset="utf-8">
var turnover_gauge = <%= query_data['turnover-gauges'].first.to_json -%>;
var data = turnover_gauge.data_warehouse.MIN_TURNOVER;
$('#minimum-turnover').gauge({
max: 20,
colors: [
'#fee',
'#fcc',
'#faa',
'#f88',
let's make a list of sinatra-based apps!
apps:
- http://github.com/cschneid/irclogger "Sinatra based irclogger.com"
- http://github.com/rtomayko/wink "minimalist blogging engine"
- http://github.com/foca/integrity "The easy and fun Continuous Integration server"
- http://github.com/sr/git-wiki "git-powered wiki"
- http://github.com/entp/seinfeld "Seinfeld-inspired productivity calendar to track your public github commits."
- http://github.com/karmi/marley "Marley, the blog engine without <textareas>. See in action @ www.restafari.org"
- http://github.com/ichverstehe/gaze "Serve up your Markdown files with this tiny Sinatra app!"
@cpjolicoeur
cpjolicoeur / gist:35280
Created December 12, 2008 21:33
This test actually passes. How? I HAVE NO IDEA
def test_should_add_a_conversation_subscription
user = Factory.create( :user )
convo = Factory.create( :conversation )
assert_equal 0, convo.subscriptions.size
assert_equal 1, convo.subscriptions.size
end
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"

Why build a site? Why do your customers care?

The core purpose of a website is to help your customers answer the questions necessary to do business with you.

If your website is a series of answers to questions then the success of your site depends on what questions you answer--it's the questions and answers that show the customer you provide a service they're looking for, you're a good choice and that they should buy from you.

In general every customer has the following questions:

  1. Who are you?
  2. What do you offer?
before(:all) do
@report = reports(:reports_001)
@site = sites(:chatswood)
@query_data = @report.query_data( :site_id => @site.dw_site_id, :date1 => 1.week.ago.to_s(:dw) , :date2 => 1.day.ago.to_s(:dw) )
end
NoMethodError in 'ExcelExport#full_report_export before(:all)'
You have a nil object when you didn't expect it!
@cpjolicoeur
cpjolicoeur / excel_export.rb
Created January 7, 2009 22:06
problems with mock/stubbing the query data
require 'spreadsheet'
class ExcelExport
# http://spreadsheet.rubyforge.org/files/GUIDE_txt.html
# http://spreadsheet.rubyforge.org/
# http://github.com/jacobat/ruby-spreadsheet/tree/master
class << self
#