Skip to content

Instantly share code, notes, and snippets.

View Jeremy-Walton's full-sized avatar

Jeremy Walton Jeremy-Walton

View GitHub Profile
require 'octokit'
require 'httparty'
require 'json'
require 'csv'
# GitHub API configuration
ACCESS_TOKEN = 'xxxxxxxxxxxxx'
ORGANIZATION = 'RoleModel'
# Octokit currently does not support the properties API
@Jeremy-Walton
Jeremy-Walton / dialog_controller.js
Last active June 24, 2023 01:25 — forked from OutlawAndy/dialog_controller.js
quick spike adapting our TurboFrame Modal approach to work with the dialog element
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static values = {
shouldOpen: Boolean,
isOpen: Boolean,
}
connect() {
if (this.shouldOpenValue) {
@Jeremy-Walton
Jeremy-Walton / card.html.slim
Created July 30, 2022 21:43
Material 3 component Implementations using the RoleModel Design System
.m3card.m3card--filled-plus-3.m3card--elevated
img.m3card__image src="https://i.scdn.co/image/ab67616d0000b273339cc033bcc476d11dffba4c"
h2.m3card__headline The Battle at Garden's Gate
h2.m3card__subhead Greta Van Fleet
.m3card__supporting-text
span 2021 · 12 songs · 1 hr 3 min
@Jeremy-Walton
Jeremy-Walton / useResettable.js
Last active March 23, 2022 21:27
A React hook that defines a standard interface for allows a component to have a resettable state that is resilient to potentially changing initial values. I have also provided an example of a simple counter that uses the hook.
/*
This is inspired by https://kentcdodds.com/blog/the-state-initializer-pattern
The interface to using this would look like:
```
const [reset, initialState] = useResettable({
count: [setCount, initialCount],
someOtherStateVariable: [setSomeOtherStateVariable, initialSomeOtherStateVariable],
})
```
Where count is a state variable that exists. `initialCount` can be a prop passed to whatever

Keybase proof

I hereby claim:

  • I am jeremy-walton on github.
  • I am jeremywalton (https://keybase.io/jeremywalton) on keybase.
  • I have a public key ASAOHjjDJpy3ySZt1GzpY1mHY2xXWOCAOFP1_csmE7FtMgo

To claim this, I am signing this object:

@Jeremy-Walton
Jeremy-Walton / Startup service
Created January 14, 2016 15:18
Startup script for file
#! /bin/sh
### BEGIN INIT INFO
# Provides: </home/pi/raspberry-occupi.py>
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Manage my cool stuff
### END INIT INFO
@Jeremy-Walton
Jeremy-Walton / raspberry-occupy.py
Last active February 25, 2020 00:49
Python script for raspberry pi reed switch sensor
import requests
import time
import json
import RPi.GPIO as io
io.setmode(io.BCM)
door_pin = 18
closed_pin = 23
opened_pin = 24
url = "http://occupi.herokuapp.com/api/door_statuses"