Skip to content

Instantly share code, notes, and snippets.

View whiteinge's full-sized avatar

Seth House whiteinge

View GitHub Profile
@whiteinge
whiteinge / index.html
Last active July 27, 2023 10:28
A wrapper around FormData to return an object with checkbox booleans and arrays for compound fields
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>A wrapper around FormData</title>
<style>
form > div { margin-bottom: 1em; }
@whiteinge
whiteinge / index.html
Last active July 27, 2023 10:29
Redux and redux-thunk implemented as component-state, or hook-state, and/or context-state
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.spinner {
margin: 0;
display: inline-block;
@whiteinge
whiteinge / index.html
Last active July 27, 2023 10:32
Example of a Mealy state machine (initial pattern stolen from somewhere that I forgot to cite)
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script src="./index.js"></script>
</body>
</html>
@whiteinge
whiteinge / .mlevilrc
Last active December 12, 2020 06:29
WIP
### mlevil
echo "-x${HOME}/.mlevil.lua"
# Normal mode
echo '-Kkmap_normal,,0'
# (define-key evil-normal-state-map "a" 'evil-append)
# (define-key evil-normal-state-map "A" 'evil-append-line)
# (define-key evil-normal-state-map "c" 'evil-change)
# (define-key evil-normal-state-map "C" 'evil-change-line)
@whiteinge
whiteinge / serenity.txt
Created January 31, 2020 04:28
Firefly-class transport ship Serenity ...in ascii
###
#######
#########
###########
#############
###########
# ########### #
#################
# ########### #
##### ############# #####
@whiteinge
whiteinge / login-csrf.sh
Created January 30, 2020 03:04
Wrapper to fetch CSRF token and authenticate via the login page
#!/usr/bin/env sh
# Wrapper to fetch CSRF token and authenticate via the login page
url='http://localhost:3002'
login="${url}/sign_in"
curl -sS -c cookies.txt "$login" |
htmlstar sel -t -v "//_:input[@name='csrf_token']/@value" -o '
' | xargs -I{} curl -sS -c cookies.txt -b cookies.txt "$login" \
--data-urlencode 'user[email]=me@example.com' \
@whiteinge
whiteinge / hello-report.txt
Last active March 4, 2024 11:57
File sizes for "hello world" in various comple-to-C and compile-to-binary languages
Default compiler settings used, unless noted otherwise. Host system is Fedora
x86_64. Linked libs produced via `ldd`.
Linked libs common to all below: linux-vdso libc ld-linux
Size Lang Specific libs Common libs
18K c - -
20K luastatic liblua libm libdl
22K vala libgobject libglib libffi libpcre libpthread
@whiteinge
whiteinge / index.html
Last active July 27, 2023 10:34
Add Shadow DOM support to hyperscript experiment
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
const el = h('div', {className: 'shadow-demos'}, [
h('style', `
.shadow-demos {
width: 300px;
@whiteinge
whiteinge / simple-vs-easy.js
Created April 30, 2019 02:36
One interpretation of simple vs. easy in JavaScript
// In my opinion the simple vs. easy division is often represented when coding
// to "layers of abstraction". Having to context-switch and switch to
// a different layer to solve a problem is noise that distracts you from the
// problem you were originally trying to solve.
// For example, if you're trying to draw a paginating, tabular, grid view of
// data to the screen it is distracting when you have to stop and wire up
// a for-loop to sum the total for the current page then again for all records.
// ---
@whiteinge
whiteinge / index.html
Created July 25, 2018 22:46
Minimal RxJS + Flux drag-and-drop to reorder POC
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>rx-drag-to-reorder</title>
<style>
#container {
width: 30em;
}