Skip to content

Instantly share code, notes, and snippets.

View jamstooks's full-sized avatar

Benjamin W Stookey jamstooks

  • Bellingham, WA
View GitHub Profile
jamstooks / machine.js
Last active May 24, 2022 21:37
Generated by XState Viz:
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
jamstooks /
Last active March 9, 2022 18:59
React Rules of Thumb

Rules of Thumb

For React Applications and Others

Brevity, but not at the expense of clarity

Consistency, but not at the expense of improvement

Less Markup

jamstooks / caching.js
Created August 10, 2020 20:05
Cache a function result in SessionStorage (no matter the properties)
import _ from 'lodash';
* Wraps a function to cache the result
* no matter what props are passed
* only caches the result if it isn't empty
* This is just using a closure for caching.
* If the function is declared again, the value will be lost.
jamstooks / useRect.js
Last active July 23, 2019 20:07
Hook to get a bounding rect object for a specific, referenced DOM object
import { useEffect, useState } from 'react'
* makes a `rect` object available to a component based on the
* dimensions of DOM object using a reference
* Usage:
* const MyComponent = (props) => {
* const _ref = useRef(null)
* const rect = useRect(_ref)
jamstooks /
Last active November 23, 2018 16:34

Random thoughts on code

index.js files get confusing in IDE tabs

In some projects I'll have 7 tabs open and six of them are labeled index.js. This can get super confusing.

So, instead of:

jamstooks /
Last active May 30, 2023 06:17
Notes on starting up an AWS Cloud9 Django dev environment with Python3

My AWS Cloud9 Setup for Python/Django and Node

Getting setup

sudo yum -y update

I'm not a big fan of their default bash prompt:

echo "export PS1='[\D{%F %T}]\n\[\e]0;\w\a\]\[\e[32m\]\u:\[\e[33m\]\w\[\e[0m\]\n\$ '" >> ~/.bashrc

source ~/.bashrc

jamstooks /
Created November 10, 2016 19:24
Potential signature generator method for MemberSuite SOAP API
from base64 import b64encode
from hashlib import sha1
import hmac
def hash_signature(url, association_id, secret_access_key, session_id=None):
Process from Membersuite Docs:
jamstooks /
Created December 6, 2013 09:04
Markdown test for


This is a tests

This is a test

Just a test gist...


jamstooks / PC Select Docs
Created August 8, 2013 19:52
Here's the spec for that jquery plugin I'm working on. There will also end up being a group of django widgets to go with it, like "CreditSelect" and "DocumentationFieldSelect" that can be restricted to specific CreditSets if necessary.
Parent-child pull-downs
I need a way to generate a set of pulldowns that can populated based on what's selected in the parent.
Required Functionality
- can be initially populated with the existing value
- assumes unique id's at every level (not going to cater to that kinda craziness)