Subscriptions with stripe
Code examples use the stripe ruby gem. Most of the links are to stripe's documentation.
![stripe's object model][stripe_object_model_diagram]
To start, create some plans.
map.connect '*path', :controller => "pages", :action => "show" |
=begin | |
Rails' index_by: the easy way to convert an Array to a Hash. | |
=end | |
Post.all.index_by(&:title) | |
=begin | |
If u r nt sure wat files a Rails generator wud create for u jst add -p for a dry run | |
=end | |
rails g model Blog -p |
user_details = User.find(id).try(:user_details).try(:first_name) | |
#no need to worry if user_details is nill |
require 'axlsx' | |
Axlsx::Package.new do |p| | |
p.workbook.add_worksheet(:name => "Pie Chart") do |sheet| | |
sheet.add_row ["Simple Pie Chart"] | |
%w(first second third).each { |label| sheet.add_row [label, rand(24)+1] } | |
sheet.add_chart(Axlsx::Bar3DChart, :start_at => "A6", :end_at => "F20", :barDir => :col) do |chart| | |
chart.add_series :data => sheet["B2:B4"], :labels => sheet["A2:A4"], :colors => ['FF0000', '00FF00', '0000FF'] | |
end | |
end | |
p.serialize('simple.xlsx') |
Sample data | |
|Name | mobile_number | | |
|Manu | 9447786299 | | |
|User | 94477xxxxx | | |
#Step1. install the required spreadsheet gem by entering: | |
$ sudo gem install spreadsheet |
# http://stackoverflow.com/a/8936202 | |
# | |
# ActiveAdmin already includes the necessary jquery in active_admin/base, | |
# so just add this to javascripts/active_admin.js after //= require active_admin/base | |
# | |
# | |
# Serialize and Sort | |
# | |
# model_name - you guessed it, the name of the model we are calling sort on. | |
# This is the actual variable name, no need to change it. |
Failure/Error: scheme.should_recieve(:update_attributes).and_return(scheme) | |
Double "Scheme_1023" received unexpected message :should_recieve with (:update_attributes) |
module RSpec | |
module Mocks | |
module AnyInstance | |
class Recorder | |
def should_recieve(*args) | |
raise NoMethodError.new "should_recieve: Did you mean 'should_receive' ?" | |
end | |
def should_not_recieve(*args) | |
raise NoMethodError.new "should_not_receive: Did you mean 'should_not_receive' ?" | |
end |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
Code examples use the stripe ruby gem. Most of the links are to stripe's documentation.
![stripe's object model][stripe_object_model_diagram]
To start, create some plans.