Skip to content

Instantly share code, notes, and snippets.

View jimthoburn's full-sized avatar

Jim Thoburn jimthoburn

View GitHub Profile
@jimthoburn
jimthoburn / render.yaml
Last active October 30, 2021 00:12
An example of how to configure a static site on Render to cache CSS files for two hours, while not caching all other paths
services:
- type: web
name: render-http-header-test
env: static
staticPublishPath: ./
headers:
# Matches all files (overridden by the rules that follow)
- path: /*
name: Cache-Control
value: no-cache
@jimthoburn
jimthoburn / machine.js
Created August 23, 2021 15:35
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jimthoburn
jimthoburn / todo-list.js
Last active August 5, 2022 22:28
Todo List
// import all of the things
const TodoList = (props) => {
const [todoList, setTodoList] = useState([]);
const [newTodo, setNewTodo] = useState("");
function updateNewTodo(event) {
setNewTodo(event.target.value);
};
@jimthoburn
jimthoburn / machine.js
Last active January 6, 2020 23:42
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jimthoburn
jimthoburn / rename.sh
Created August 30, 2018 01:47
Rename multiple files from “.md” to “.markdown”
for file in *.md
do
mv "$file" "${file%.md}.markdown"
done
@jimthoburn
jimthoburn / save-restore-scroll-position.js
Last active June 14, 2018 18:23
Save & restore scroll position
(function() {
var position
function saveScrollPosition() {
// If we don’t already have a saved scroll position
if (position == null || position <= 0) {
position = window.scrollY
}
}
@jimthoburn
jimthoburn / gulpfile.js
Last active June 21, 2017 20:33
Gulp Resize Images, Example
// https://github.com/gulpjs/gulp
var gulp = require('gulp');
// https://www.npmjs.com/package/gulp-image-resize
var imageResize = require('gulp-image-resize');
var parallel = require("concurrent-transform");
var os = require("os");
@jimthoburn
jimthoburn / mob-coding-challenge.js
Created April 20, 2017 02:19 — forked from theknoosh/mob-coding-challenge.js
A saved mob programming session with Learn Teach Code!
// If we all shook each others' hands once (and only once),
// how many handshakes would that be??
// Write a function that calculates how many handshakes will
// occur for a given number of people.
function countHandshakes (numPeople) {
var total_count = 0;
// loop through each of the people
for (var index = 0; index < numPeople; index++ ){
// shake each person’s hand who you haven’t shaken yet
@jimthoburn
jimthoburn / mob-coding-challenge.js
Created April 20, 2017 02:16 — forked from theknoosh/mob-coding-challenge.js
A saved mob programming session with Learn Teach Code!
// If we all shook each others' hands once (and only once),
// how many handshakes would that be??
// Write a function that calculates how many handshakes will
// occur for a given number of people.
function countHandshakes (numPeople) {
var total_count = 0;
// loop through each of the people
for (var counter = 0; counter < numPeople; counter++ ){
// shake each person’s hand who you haven’t shaken yet
@jimthoburn
jimthoburn / mob-coding-challenge.js
Created April 20, 2017 02:13 — forked from theknoosh/mob-coding-challenge.js
A saved mob programming session with Learn Teach Code!
// If we all shook each others' hands once (and only once),
// how many handshakes would that be??
// Write a function that calculates how many handshakes will
// occur for a given number of people.
function countHandshakes (people) {
var total_count = 0;
// loop through each of the people
for (var counter = 0; counter < people;counter++ ){
// shake each person’s hand who you haven’t shaken yet