Skip to content

Instantly share code, notes, and snippets.

Bulletninja /
Created May 26, 2020 — forked from colllin/
Auth0 + FaunaDB integration strategy



At the very least, we need two pieces of functionality:

  1. Create a user document in Fauna to represent each Auth0 user.
  2. Exchange an Auth0 JWT for a FaunaDB user secret.
Bulletninja /
Created May 26, 2020 — forked from colllin/
FaunaDB User Token Expiration (for ABAC)

Auth0 + FaunaDB ABAC integration: How to expire Fauna user secrets.

Fauna doesn't (yet?) provide guaranteed expiration/TTL for ABAC tokens, so we need to implement it ourselves if we care about it.

What's in the box?

3 javascript functions, each of which can be imported into your project or run from the command-line using node path/to/script.js arg1 arg2 ... argN:

  1. deploy-schema.js: a javascript function for creating supporting collections and indexes in your Fauna database.
Bulletninja / useFieldArray.js
Created May 17, 2020 — forked from joshsalverda/useFieldArray.js
Custom useFieldArray hook for formik using immutability-helper
View useFieldArray.js
import {useCallback, useRef, useEffect} from 'react'
import {useField, useFormikContext} from 'formik'
import update from 'immutability-helper'
const useFieldArray = props => {
const [field, meta] = useField(props)
const fieldArray = useRef(field.value)
const {setFieldValue} = useFormikContext()
useEffect(() => {
View js_programming_patterns.js
// one loop multiple checks (can be turned into a builder of other datastructure
const exampleValues = [2, 15, 8, 23, 1, 32];
const [truthyValues, falseyValues] = exampleValues.reduce((arrays, exampleValue) => {
if (exampleValue > 10) {
return arrays;
View run_async_threaded
def run_async(f, lock=None):
import weakref
from threading import Thread
def args_wrapper(*args, **kwargs):
class FunctionRunner(Thread):
def run(self):
if lock is not None: lock.acquire()
self.result = f(*args, **kwargs)
View gist:6daca6bd5cfe58c9c6fed5340a5f0de0
var Twit = require("twit");
var Bot = new Twit({
consumer_key: "", //tu consumer key
consumer_secret: "", // tu consumer secret
access_token: "", //tu acess token
access_token_secret: "" //tu access token secret
});'statuses/update', {status: "Hola desde node con twit!"}, function(err, data, response){
Bulletninja /
Last active Oct 29, 2015 — forked from giorgiofellipe/
Install PHP PGSQL extensions on Mac OS X Yosemite (change PHP_VER with your PHP version)
# Check if extension exists first
php -m | grep pgsql
# Update brew and install requirements
brew update
brew install autoconf
# Download PHP source and extract