Skip to content

Instantly share code, notes, and snippets.

View cjavilla-stripe's full-sized avatar

CJ Avilla cjavilla-stripe

View GitHub Profile
type DOB struct {
DOBYear int
DOBMonth int
DOBDay int
}
type Person struct {
Name string
DOB // anonymous field is "embedded"
}
friend := Person{
// ------ py
class Robot:
# `self` in python is the instance
def move_forward(self, spaces=1):
print('Moving forward %d spaces' % (spaces))
r = Robot()
r.move_forward(2)
// ----- go
type Robot struct {}
package main
import (
"fmt"
)
func a(x chan int) {
fmt.Println("a")
x <- 9
}
#!/usr/bin/ruby
require 'octokit'
require 'dotenv'
require 'restclient'
require 'json'
Dotenv.load('.env_shortcut')
GITHUB = "https://raw.githubusercontent.com/%s/master/.cli.json"
#!/usr/bin/ruby
require 'octokit'
require 'dotenv'
require 'restclient'
require 'json'
Dotenv.load('.env_shortcut')
GITHUB = "https://raw.githubusercontent.com/%s/master/.cli.json"

See the setup.js file below which shows how to create the right kinds of products and prices. The report.js file shows how the periodic usage reporting would work.

In order to use a model where a new invoice is cut every time usage reaches a threshold, but also to support the case where we can handle decreasing usage over time, we have to take a hybrid approach where we keep track of how many images are already paid for in a given period, and only report usage over that amount.

const http = require('http');
const hostname = 'localhost';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World!\n');
});
@cjavilla-stripe
cjavilla-stripe / Dockerfile
Last active August 27, 2020 21:26
Stripe Samples Dokku Dockerfile
# Use Node 14
FROM node:14 AS build
# Create a folder for our app, and it's client.
RUN mkdir /app
RUN mkdir /app/client
# Set up the working directory
WORKDIR /app
{
"Working Directory" : "/",
"Prompt Before Closing 2" : false,
"Selected Text Color" : {
"Red Component" : 0.91764705882352937,
"Color Space" : "sRGB",
"Blue Component" : 0.98431372549019602,
"Alpha Component" : 1,
"Green Component" : 0.94117647058823528
},
{
"Working Directory" : "\/Users\/cjavilla\/",
"Prompt Before Closing 2" : false,
"Selected Text Color" : {
"Red Component" : 0.92941176470588238,
"Color Space" : "sRGB",
"Blue Component" : 1,
"Alpha Component" : 1,
"Green Component" : 0.92941176470588238
},