Skip to content

Instantly share code, notes, and snippets.

View mcabrams's full-sized avatar
🤙
Wherever you go... there you are

Matthew Abrams mcabrams

🤙
Wherever you go... there you are
View GitHub Profile
### Keybase proof
I hereby claim:
* I am mcabrams on github.
* I am mcabrams (https://keybase.io/mcabrams) on keybase.
* I have a public key ASDVmUW_AwZhhFQ2yXwx8-85auCtReUxhZYkW9ab_c55tAo
To claim this, I am signing this object:
@mcabrams
mcabrams / machine.js
Last active July 7, 2020 21:27
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
try:
# Use Stripe's library to make requests...
stripe.PaymentIntent.create(......)
except stripe.error.CardError as e:
# Since it's a decline, stripe.error.CardError will be caught
print('Status is: %s' % e.http_status)
print('Type is: %s' % e.error.type)
print('Code is: %s' % e.error.code)
# param is '' in this case
@api_view(['POST'])
def stripe_session(request):
meeting_id = request.data.get('meetingId')
meeting = Meeting.objects.get(zoom_meeting__zoom_id=meeting_id)
stripe_account_id = meeting.creator.stripe_account_id
print(settings.STRIPE_API_KEY)
stripe.api_key = settings.STRIPE_API_KEY
session = stripe.checkout.Session.create(
payment_method_types=['card'],
@mcabrams
mcabrams / .py
Last active April 4, 2019 00:42
Factory boy - related factory retrieval
# Models
class Foo(Model):
text = models.CharField(max_length=64, blank=False)
class Bar(Model):
text = models.CharField(max_length=64, blank=False)
# Factories
class FooFactory(factory.django.DjangoModelFactory):
// This is a configuration for Phoenix <https://github.com/sdegutis/Phoenix>,
// a super-lightweight OS X window manager that can be configured and
// scripted through Javascript.
var mNone = [],
mCmd = ['cmd'],
mShift = ['shift'],
nudgePixels = 10,
padding = 0,
previousSizes = {};