Skip to content

Instantly share code, notes, and snippets.

View Frenchcooc's full-sized avatar
☄️
We're hiring 🤘

Corentin Frenchcooc

☄️
We're hiring 🤘
View GitHub Profile

Time To First API Call - Stripe

Steps to reproduce:

  1. 00:00 - Sign in to Stripe

  2. 00:42 - Retrieve your API Key

  3. 01:01 - Prepare your Stripe API integration

mkdir ttfac-stripe

How to rename a setupId in Pizzly.

Pizzly uses uuidv4 to generate pseudo-random setupId, such as a3ef22ba-8916-424f-b613-9e8608026094. In some cases, you might be interested in renaming the setupId to something more meaningful. Here's how to do it.

Server side

Assuming you can't run SQL queries on your production database, to rename a setupId on your Pizzly instance (e.g. on Heroku), you'll have to create a new endpoint on Pizzly's API and request that endpoint each time you want to rename a setupId.

Here's how to do it:

// Require the library and client
const circuitBreaker = require("opossum")
const apiClient = require("our-example-api-client")
// Our example request
const getPosts = (req, res, next) => {
// Wrap our client get method in the circuit breaker
const breaker = circuitBreaker(apiClient.get, {
timeout: 3000,
errorThresholdPercentage: 50,
resetTimeout: 5000
@Frenchcooc
Frenchcooc / index.ts
Created January 17, 2020 16:09
Bearer Agent setup on Cloud Functions for Firebase
const Bearer = require('@bearer/node-agent')
Bearer.init({ secretKey: '...' })
import * as functions from 'firebase-functions'
import axios from 'axios'
export const test = functions.https.onRequest((request, response) => {
response.send('Hello from Firebase!')
})

Let's see how to post a message with a Slack bot, using Bearer.sh.

Steps

  1. Create a custom API on Bearer.sh dashboard (learn how here).
  2. Use the configuration below for that custom API
  3. Create a Slack bot on Slack (link)
  4. Register the Bot API Key on Bearer (it starts with xoxb-...)
  5. Post to a channel using the snippet below
@Frenchcooc
Frenchcooc / SDK.md
Last active June 12, 2019 13:21
Collection of different SDK

Below is a collection of different SDK for the following APIs:

Stripe

@Frenchcooc
Frenchcooc / HTTPClients.md
Last active June 6, 2019 13:21
Different sdks
@Frenchcooc
Frenchcooc / oauth.js
Last active April 2, 2019 12:02
Fast expressjs app to retrieve OAuth tokens
/**
* Quick express-app to retrieve OAuth credentials
*
* Run it with $ node index.js
*/
const express = require('express')
const request = require('request')
const app = express()
@Frenchcooc
Frenchcooc / eventlistener.js
Created December 2, 2018 18:31
Easy to use JS EventListener class
"use strict";
class EventListener {
constructor () {
// Declare variables
this._onEvents = [];
return this;
@Frenchcooc
Frenchcooc / List of the most common MIME types
Created July 19, 2018 13:13
Incomplete list of the most common MIME types
application/EDI-X12
application/EDIFACT
application/epub+zip
application/java-archive
application/javascript
application/json
application/ld+json
application/ms-word
application/msword
application/octet-stream