Skip to content

Instantly share code, notes, and snippets.

View notrab's full-sized avatar

Jamie Barton notrab

View GitHub Profile
import NextAuth, { type NextAuthConfig } from "next-auth";
import GitHub from "next-auth/providers/github";
import type {
Adapter,
AdapterAccount,
AdapterSession,
AdapterUser,
VerificationToken as AdapterVerificationToken,
} from "@auth/core/adapters";
import { createClient, type Client as TursoClient } from "@libsql/client";
{
"editor.fontSize": 16,
"editor.lineHeight": 25,
"editor.letterSpacing": 0.25,
"editor.formatOnSave": true,
"editor.lineNumbers": "relative",
"editor.colorDecorators": false,
"files.exclude": {
"**/.cache": true,
"**/.DS_Store": true,
echo "Disable Java within Safari"
defaults write com.apple.Safari \
com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled \
-bool false
defaults write com.apple.Safari \
com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabledForLocalFiles \
-bool false
echo "Disable local Time Machine backups"
hash tmutil &> /dev/null && sudo tmutil disablelocal
#!/bin/sh
brew bundle --file=- <<EOF
brew 'httpie'
brew 'mysql'
brew 'tree'
brew 'gist'
brew 'speedtest_cli'
brew 'sqlite'
brew 'ssh-copy-id'
import React, { createContext, useContext, useReducer } from 'react'
const EMPTY_CART = 'EMPTY_CART'
const ADD_ITEM = 'ADD_ITEM'
const UPDATE_ITEM = 'UPDATE_ITEM'
const REMOVE_ITEM = 'REMOVE_ITEM'
const CartContext = createContext()
const defaultCartState = {
@notrab
notrab / keybindings.json
Created July 13, 2019 11:28
Visual studio config
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1"
},
{
"key": "ctrl+1",
"command": "-workbench.action.openEditorAtIndex1"
},
@notrab
notrab / Embed.js
Created May 22, 2019 09:50
Embed.js
import React from 'react'
import ReactDOM from 'react-dom'
import { createClient } from '@moltin/request'
import { createStore, StoreProvider } from 'easy-peasy'
import { ThemeProvider } from 'styled-components'
import model from './model'
import Modal from './components/Modal'
import BuyButton from './components/BuyButton'
import React from 'react'
import Link from 'next/link'
import classNames from 'classnames'
import Logout from './Logout'
import QuickStart from '../QuickStart'
import Logo from './Logo'
const HomeHeader = ({ loggedIn }) => (
<div className="hidden lg:flex lg:items-center lg:w-1/4 px-6">
@notrab
notrab / README.md
Last active February 2, 2019 16:09

Moltin JS SDK

  • Version: 4
import MoltinClient from '@moltin/sdk'

const moltin = new MoltinClient({
  client_id: '...'
})

Authentication

Every request to Moltin requires an accompanying Bearer token. There are two token types available; implicit and client_credentials.

We're going to be using the implicit grant type for the next few steps. The implicit grant type can be thought of as READ ONLY and are mostly used client-side.

Every user is given their own API keys for every project they're invited to or create. These are required to authenticate.

Get your API keys