Skip to content

Instantly share code, notes, and snippets.

Larry Botha larrybotha

Block or report user

Report or block larrybotha

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@larrybotha
larrybotha / A.markdown
Last active Oct 7, 2019
XState + AWS Amplify example
View A.markdown

XState + AWS Amplify example

A breakdown of a project that uses XState to manage state for authenticating a user with Cognito, and then finding the authorized application user with an invoked machine.

  1. create auth machine
  2. create auth context
  3. handle AWS authentication
  4. once user authenticates with Cognito, redirect to user route to get user from db
  5. at user route use userMachine service from authMachine to get application user
  6. once associated application user is found, send user to organization route to allow user to associate session with specific organization
View machine.js
const bullishMachineConfig = {
initial: 'findingStock',
on: {
MARKET_TRENDING_DOWN: 'bearish',
MARKET_TRENDING_SIDEWAYS: 'evaluatingGeneralMarket',
},
states: {
findingStock: {
View machine.js
const fetchMachine = Machine({
id: 'auth',
initial: 'unknown',
states: {
unknown: {
on: {
'': [
{
View machine.js
const tradingStrategyMachine = Machine({
id: 'three-step-trading-process',
initial: 'backtesting',
context: {
timesRefactored: 0,
},
states: {
View machine.js
const xeroOrgMachine = Machine({
id: 'xeroOrg',
initial: 'noOrg',
states: {
noOrg: {
invoke: {
src: "requestAuthUrl",
onDone: "exchangingToken",
View machine.js
const userMachine = Machine({
id: "user",
initial: "noUser",
states: {
noUser: {
invoke: {
src: "getUser",
onDone: "userFound",
@larrybotha
larrybotha / A.markdown
Last active Apr 7, 2017
Two.js Renderer for PhysicsJS
View A.markdown

Two.js Renderer for PhysicsJS

A starting point for a Two.js renderer for PhysicsJS.

@larrybotha
larrybotha / A.markdown
Last active Sep 16, 2019
Mac OS Sierra MySQL my.conf
View A.markdown

Fixing Mac OS Sierra MySQL Woes

MySQL throwing ERROR 2006 (HY000): MySQL server has gone away?

mysql -u root -p
# enter password

mysql > SET GLOBAL max_allowed_packet=1073741824;
@larrybotha
larrybotha / A.markdown
Last active Dec 2, 2016
Google Apps Scripts Spreadsheet Submission
View A.markdown

Post To Google Sheets -> Scripts Submission Handler

A Google Apps Script to handle submissions sent to a Google Sheet via a webform, and send emails each time a submission is received.

Largely inspired by Google Sheets as a Database – INSERT with Apps Script using POST/GET methods.

This script must be added to your Google Sheet via 'Tools' -> 'Script Editor...'.

Your spreadsheet's column names must match the field names on your firm to properly submit data.

You can’t perform that action at this time.