This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
@options = {} | |
class << self | |
def inherited(subclass) | |
subclass.options = {} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Coupon | |
class << self | |
def enforce_interface! | |
methods = self.instance_methods(false) | |
[:m].each do |method_name| | |
unless methods.include? method_name | |
raise "#{method_name} should be implemented" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl https://api.stripe.com/v1/subscriptions | |
-u API_KEY: | |
-d plan=account1_subscription25_1462918904 | |
-d customer=cus_8QbM9gs5JyjLGs | |
-d trial_end=1462942058 | |
curl https://api.stripe.com/v1/subscriptions/sub_8QbO9XNSu8xEIX | |
-u API_KEY: | |
-d "metadata[account_id]=2&metadata[ignore_cancelation]=true&metadata[subscription_id]=19" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
hbspt.forms.create({ | |
portalId: '453289', | |
formId: 'faafbc57-6c2f-49a6-87ef-02c8653fdb30', | |
submitButtonClass: 'submitbutton', | |
redirectUrl: 'https://www.localhost.twenty20.com/pricing?roadblock=skip', | |
// This is never called. | |
onFormSubmit: function() { console.log("---------- onFormSubmit"); debugger; }, | |
// This one works find. | |
onFormReady: function() { console.log("---------- onFormReady"); debugger; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
organize [ | |
Interactors::Upgrade::EnsureAccountOwner, | |
->(ctx) { ctx.payment_source = ctx.current_subscription.payment_source }, | |
Interactors::Upgrade::EnsureValidUpgrade, | |
->(ctx) { Interactors::Subscribe::CreateSubscription.call(ctx, ended_at: ctx.upgraded_at) } | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Interactor1 | |
def call | |
context.fail! error: 'Failure. This is lost.' | |
end | |
end | |
class Interactor2 | |
def call | |
foreign_context = Interactor1.call!(b: 2) | |
puts "THIS WILL NEVER BE CALLED." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EventeableMixin = Ember.Mixin.create | |
# Handle eventBroker change, tricky one! | |
init: -> | |
if !@get('eventBroker') | |
@set('eventBroker', create_local_event_broker) | |
register_events_listeners() | |
register_events_listeners: -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`import Ember from 'ember'` | |
# Where we save channels. | |
# The format is: | |
# channels = { "components.auth" { "submit": { /* hash of callbacks */ } }} | |
channels = {} | |
# Given hash, search for keys that match a pattern and call "callback" on them | |
# Ex: forEachMatch({ "a.b.c": 1, "a.b": 2, "x.y": 3 }, 'a.b.c', fn) will call fn twice with: fn(1) and fn(2) | |
forEachMatch = (list, key, callback) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'contracts' | |
module Organizer | |
include Contracts | |
Contract KeywordArgs[list: ArrayOf[RespondTo[:call]], ctx: Optional[Hash]] => [Symbol, Hash] | |
def self.call(list:, ctx: {}) | |
result = :ok | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| D1 | D2 | D3 | |
R1 | A | W | 0 | |
R2 | A | W | 1 | |
R3 | A | X | 2 | |
R4 | A | X | 3 | |
R5 | A | Y | 4 | |
R6 | B | Y | 5 | |
R7 | B | Z | 6 | |
R8 | C | Z | 1 |
OlderNewer