Skip to content

Instantly share code, notes, and snippets.

View jonsgreen's full-sized avatar

Jonathan jonsgreen

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jonsgreen on github.
  • I am jonsgreen (https://keybase.io/jonsgreen) on keybase.
  • I have a public key ASCghHloVFttFl7SMXKYbCrndpyFPApHKvDo3TpuFLGTawo

To claim this, I am signing this object:

@jonsgreen
jonsgreen / Subscription Flow.md
Last active August 22, 2018 23:07
Subscription Flow Further Backend Details

Payment

here is the User Experience that we are shooting for initially:

  1. An owner arrives at /signup.
  2. they enter account details and create the account
  3. they select a subscription level
  4. enter cc information (card#159)
  5. they arrive at /new/studio, having bypassed 'choose user type screen'
  6. they enter the name and site Id for their studio.
class GradeCam::Launch
attr_reader :assessment_session, :user, :url
def initialize(assessment_session, user, url)
@assessment_session, @user, @url = assessment_session, user, url
end
def params
@params ||= { context_id: assessment_session.classroom.id,
require ::File.expand_path('../config/environment', __FILE__)
require ::File.expand_path('../lib/slack_bot', __FILE__)
Thread.abort_on_exception = true
Apartment.tenant_names.each do |schema|
if token = ENV["#{schema.upcase}_SLACK_API_TOKEN"]
Thread.new do
SlackBot.new(schema, token).bot.run
end
end
@jonsgreen
jonsgreen / gist:9cc19a9bdb0eeb2cda59
Created March 10, 2015 20:40
Mailchimp integration with locking
def sync
loop do
User.transaction do
@supporter_batch = supporter_batch_relation.lock
@supporters = @supporter_batch.to_a
break if @supporters.size <= MIN_BATCH_SIZE
@supporter_batch.update_all(mail_service_identifier: 'pending')
end
@supporters.map do |supporter|
sync_supporter(supporter)
@jonsgreen
jonsgreen / gist:11360045
Created April 28, 2014 01:56
More TZ World Map Trouble
~/Downloads/tz_world_ingredients/world $ sh process.sh
process.sh: line 9: psql.exe: command not found
Unable to open ../../fips_10/map/fips10s.shp or ../../fips_10/map/fips10s.SHP.
../../fips_10/map/fips10s: dbf file (.dbf) can not be opened.
Shapefile type: Polygon
Postgis type: POLYGON[2]
SET
SET
BEGIN
ERROR: relation "tz_canada_mask" does not exist
@jonsgreen
jonsgreen / gist:11359935
Created April 28, 2014 01:48
TZ World Map Ingredients Processing trouble
~ $ ./Downloads/tz_world_ingredients/world/process.sh
./Downloads/tz_world_ingredients/world/process.sh: line 9: psql.exe: command not found
Unable to open ../../fips_10/map/fips10s.shp or ../../fips_10/map/fips10s.SHP.
../../fips_10/map/fips10s: dbf file (.dbf) can not be opened.
Unable to open ../canada/tz_canada_01.shp or ../canada/tz_canada_01.SHP.
../canada/tz_canada_01: dbf file (.dbf) can not be opened.
Unable to open ../canada/tz_canada_02.shp or ../canada/tz_canada_02.SHP.
../canada/tz_canada_02: dbf file (.dbf) can not be opened.
Unable to open ../canada/tz_canada_03.shp or ../canada/tz_canada_03.SHP.
../canada/tz_canada_03: dbf file (.dbf) can not be opened.
@jonsgreen
jonsgreen / gist:8016317
Created December 18, 2013 02:19
fetch the sharing div
/*
fetch
fetch the sharing div
*/
fetch: function(element) {
if (sharing.debug) { $.d('Fetch'); $.d(element); }
module HstoreSerializer
extend ActiveSupport::Concern
module ClassMethods def hstore_array(*attributes)
attributes.each do |attr|
define_method "#{attr}=" do |values|
self[attr] = convert_to_hash(values)
end
define_method attr do
DOMAIN = "smackaho.st"
Given /^I am in subdomain "(.+)"$/ do |subdomain|
if Capybara.current_driver == :webkit
port = page.driver.instance_variable_get(:@rack_server).port
Capybara.app_host = "http://#{subdomain}.#{DOMAIN}:#{port}"
else
Capybara.default_host = "http://#{subdomain}.#{DOMAIN}"
switch_session(subdomain)
visit("http://#{subdomain}.#{DOMAIN}")