Skip to content

Instantly share code, notes, and snippets.

View cstumph's full-sized avatar

Christopher Stumph cstumph

View GitHub Profile
@othiym23
othiym23 / skiffy.md
Created August 10, 2014 07:56
some sf and fantasy recommendations

The Winterlong Trilogy by Elizabeth Hand

Gothic, Grand Guignol-drenched post-apocalyptic science-fantasy. "Febrile" is a word that comes to mind – the language is overstuffed, it's dense with references to fantasy and folklore, and the characters are run through the wringer. Not the last of her novels to feature a transmogrified Washington DC as a primary venue.

Waking the Moon by Elizabeth Hand

Roman á clef and supernatural romance (in the traditional, not Twilight sense) featuring the hidden war between the Benandanti, a sect of nasty old patriarchal quasi-Catholics, and the forces of Othiym Lunarsa, goddess of a long-suppressed matriarchal death cult. If Camille Paglia ever read this, she probably loved it, but the central story is basically an overheated, fantastic version of Whit Stillman's Metropolitan and so th

@bendc
bendc / functional-utils.js
Last active September 15, 2023 12:12
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
@thefotios
thefotios / emojify.sh
Created July 21, 2015 20:30
Makes properly sized emoji for slack. Just point this at any URL. You'll need to have `convert` (part of ImageMagick)
#!/usr/bin/env bash
url=$1;
output=${2-output.png};
size=${3-128};
curl --silent -kL $url | convert - -resize ${size}x${size} $output;
@evantahler
evantahler / buildSitemap.js
Last active December 17, 2020 16:35
35 lines to build a sitemap for next.js projects
#! /usr/bin/env node
// I am ./bin/buildSitemap.js
const path = require('path')
const glob = require('glob')
const fs = require('fs')
const SITE_ROOT = process.env.SITE_ROOT || 'https://www.actionherojs.com'
const SOURCE = process.env.SOURCE || path.join(__dirname, '..', 'pages', '/**/*.js')
const DESTINATION = process.env.DESTINATION || path.join(__dirname, '..', 'static', 'sitemap.xml')
// @flow
import * as React from 'react';
// inside functional components, you can drop this hook
// and be notified when the modified component re-renders.
// this component will also tell you _why_ it was re-rendered
export default function useTraceUpdate(props: any) {
const prev = React.useRef(props);
React.useEffect(() => {
@rsms
rsms / fps.ts
Created November 3, 2019 20:25
FPS measurement in web browser
// measureFPS uses requestAnimationFrame to measure frame times and reports
// the average frames per second.
//
function measureFPS(report :(fps:number)=>void) {
const samplesSize = 120 // total number of frame times look at (window size)
const samples :number[] = [] // ring buffer; sliding window
const reportAt = Math.round(samplesSize / 4)
let samplesIndex = 0 // next index in samples
let prevTime = 0 // last time value; frameTime = prevTime - time