Skip to content

Instantly share code, notes, and snippets.

View linojon's full-sized avatar

Jonathan Linowes linojon

View GitHub Profile
def is_due?
return true if past_due?
if next_renewal_on <= Time.zone.today
past_due!
end
past_due?
end
@linojon
linojon / gist:189670
Created September 20, 2009 01:46
code snippets used in the SaasRamp screencast
# Some handy code snippets are used in the SaasRamp screencast (http://www.vaporbase.com/postings/SaasRamp_Screencast)
# File: environment.rb
config.gem 'activemerchant', :lib => 'active_merchant'
config.gem 'money'
config.gem 'state_machine'
config.gem 'lockfile'
config.active_record.observers = :subscription_observer
@linojon
linojon / gist:189671
Created September 20, 2009 02:03
code snippets used in the AuthApp screencast
# File: features/support/path.rb
when /login/
login_path
when /signup/
signup_path
# File: features/support/user_helpers.rb
module UserHelpers
def create_user( options = {} )
args = {
# code borrowed error_messages_for
def error_counts_for(*params)
#debugger
options = params.extract_options!.symbolize_keys
if object = options.delete(:object)
objects = [object].flatten
else
objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact
end
#count = objects.inject(0) {|sum, object| sum + (object.errors.count.zero? ? 0 : 1) }
LocalJumpError in Subscriptions#credit_card
Showing app/views/subscriptions/credit_card.html.erb where line #25 raised:
no block given
Extracted source (around line #25):
23: <%= label_content 'Card expires on:' %>
$('#flash').animate(
{backgroundColor: '#ffff00'}, 'normal', 'linear',
function(){
$(this).animate(
{backgroundColor: '#00ff00'}, 'normal', 'linear',
function(){
$(this).animate(
{backgroundColor: '#0000ff'}, 'normal', 'linear',
function(){
$(this).animate(
Permission denied to...a non-chrome context19(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression:
Processing ApplicationController#index (for 67.45.129.217 at 2009-11-30 22:12:25) [GET]
ActionController::RoutingError (No route matches "/default+en.I.js" with {:request_uri=>"/default+en.I.js", :domain=>"reviewramp.com", :method=>:get, :port=>80, :content_type=>nil, :protocol=>"http://", :remote_ip=>"67.45.129.217", :subdomain=>"", :accepts=>"text/html,application/xml,*/*"}):
Rendering rescues/layout (not_found)
SQL (0.1ms) SET SQL_AUTO_IS_NULL=0
Processing ApplicationController#index (for 67.45.129.217 at 2009-11-30 22:12:25) [GET]
Processing ApplicationController#index (for 67.45.129.217 at 2009-11-30 22:12:25) [GET]
ActionController::RoutingError (No route matches "/default+en.I.js" with {:request_uri=>"/default+en.I.js", :domain=>"reviewramp.com", :method=>:get, :port=>80, :content_type=>nil, :protocol=>"http://", :remote_ip=>"67.45.129.217", :subdomain=>"", :accepts=>"text/html,application/xml,*/*"}):
Rendering rescues/layout (not_found)
SQL (0.1ms) SET SQL_AUTO_IS_NULL=0
Processing ApplicationController#index (for 67.45.129.217 at 2009-11-30 22:12:25) [GET]
[12:55][jonathan@jsl:~/rails/rr3]$ rails s
/Users/jonathan/.rvm/gems/ruby-1.9.2-preview1/gems/activesupport-3.0.0.beta/lib/active_support/core_ext/object/try.rb:29: [BUG] rb_add_method: unsupported method type (8)
ruby 1.9.2dev (2009-07-18 trunk 24186) [i386-darwin10.2.0]
-- control frame ----------
c:0030 p:---- s:0080 b:0080 l:000079 d:000079 CFUNC :alias_method
c:0029 p:0044 s:0075 b:0075 l:000074 d:000074 CLASS /Users/jonathan/.rvm/gems/ruby-1.9.2-preview1/gems/activesupport-3.0.0.beta/lib/active_support/core_ext/object/try.rb:29
c:0028 p:0009 s:0073 b:0073 l:000072 d:000072 TOP /Users/jonathan/.rvm/gems/ruby-1.9.2-preview1/gems/activesupport-3.0.0.beta/lib/active_support/core_ext/object/try.rb:1
c:0027 p:---- s:0071 b:0071 l:000070 d:000070 FINISH