Skip to content

Instantly share code, notes, and snippets.

View tapatio's full-sized avatar
💭
I may be slow to respond.

Jeff Szielenski tapatio

💭
I may be slow to respond.
View GitHub Profile
@jeffsoup
jeffsoup / bookshelf-transaction-test.js
Last active July 31, 2021 02:32
Small Example of A Bookshelf Transaction
import config from '../src/config'
import chai, { expect, should, assert } from 'chai'
import _ from 'lodash'
const knex = require('knex')(config.database)
const bookshelf = require('bookshelf')(knex)
const Test = bookshelf.Model.extend({
tableName: 'TEST_ONLY',
idAttribute: 'ID',
@gr2m
gr2m / account_dreamcode.js
Last active May 7, 2022 08:22
Imagine the typical backend tasks for user authentication would exist right in the browser. How would the code look like? This is what I came up with. Forks & comments much appreciated! #nobackend #dreamcode
// sign up
account.signUp('[email protected]', 'secret');
// sign in
account.signIn('[email protected]', 'secret');
// sign in via oauth
account.signInWith('twitter');
// sign out