Skip to content

Instantly share code, notes, and snippets.

@mwunsch
mwunsch / broadcast.rkt
Last active December 22, 2020 02:08
!!con 2018 Presentation - Overscan
#lang overscan
(require overscan/macos
overscan/draw
(only-in racket/file make-temporary-file)
racket/draw
(only-in racket/math pi)
"twitch-secret.rkt")
(define cam+screen
@mwunsch
mwunsch / Main.elm
Last active March 22, 2017 01:12
Elm Boilerplate
module Main exposing (..)
-- Stick this Elm file in a directory. Run `elm make` in the
-- directory. Run `elm reactor`. Now you have an Elm program.
import Html exposing (..)
main : Program Never Model Msg
main =
@mwunsch
mwunsch / index.js
Last active July 20, 2016 17:53
CFN Custom Resource - GitHub CodeDeploy webhook
const response = require('cfn-response');
const http = require('https');
const url = require('url');
exports.handler = function(event, context) {
var props = event.ResourceProperties;
var options = {
hostname: 'api.github.com',
headers: {
'Accept': 'application/vnd.github.v3+json',
'Authorization': `token ${props.GitHubToken}`,
void setup() {
size(1080, 1080);
noStroke();
background(0, 0, 255);
int rows = int(pow(2, int(random(1,6))));
int u = height / (rows + 4);
int thickness = int(pow(2, int(random(1, 4))));
int uth1 = u / thickness;
int uth2 = u + uth1;
int startX = int(-u * 0.75);
@mwunsch
mwunsch / dom-zipper.js
Last active August 29, 2015 14:19
A blah implementation of a Zipper for the DOM
/* I'm not thrilled with this, but it should be enough to demonstrate ... something ... */
function Breadcrumb(el) {
this.path = el.parentElement ? new Breadcrumb(el.parentElement) : null;
this.left = el.previousElementSibling;
this.right = el.nextElementSibling;
}
function Zipper(tree, path) {
this.tree = tree;
this.crumb = new Breadcrumb(tree);
@mwunsch
mwunsch / dress.html
Created April 23, 2015 21:04
createTreeWalker + createDocumentFragment = diff
<!DOCTYPE html>
<html>
<head></head>
<body>
<div class="grid-thumb" id="grid-thumb-viv9" data-style-name="VIV9">
<a class="item-link" href="/shop/designers/vivienne_westwood_anglomania/julia_dress">
<div class="grid-thumb-images">
<img class="current" alt="Vivienne%20Westwood%20Anglomania - Julia%20Dress" width="270" height="405" src="https://pc-ap.renttherunway.com/productimages/front/270x/fc/VIV9.jpg">
<img alt="Vivienne%20Westwood%20Anglomania - Julia%20Dress" width="270" height="405" src="https://pc-ap.renttherunway.com/productimages/side/270x/fc/VIV9.jpg" class="">
<img alt="Vivienne%20Westwood%20Anglomania - Julia%20Dress" width="270" height="405" src="https://pc-ap.renttherunway.com/productimages/back/270x/fc/VIV9.jpg">
@mwunsch
mwunsch / viz.js
Created April 23, 2015 14:31
DOM -> Graphviz
/*
This is an incredibly rudimentary PhantomJS script to walk a DOM and emit a graphviz `dot` document.
It is neither clever nor good.
Proceed with caution.
Usage: phantomjs viz.js http://2015.empirejs.org/ | tee >(dot -Tpng > test.png)
*/
var page = require('webpage').create();
var args = require('system').args;
@mwunsch
mwunsch / puthtml.sh
Last active August 29, 2015 14:06
Upload from shell to http://www.puthtml.com/
puthtml ()
{
curl -F "file=@${1:--};filename=${1:-`uuidgen`.html}" \
-F "api_key=${2:-$PUTHTML_API_KEY}" \
http://www.puthtml.com/;
}
require 'rumoji'
codepoints = Rumoji::Emoji::ALL.map(&:hex).map(&:downcase)
codepoints.each do |c|
puts "https://abs.twimg.com/emoji/v1/72x72/#{c}.png"
end
@mwunsch
mwunsch / keybase.md
Created March 11, 2014 17:04
keybase.md

Keybase proof

I hereby claim:

  • I am mwunsch on github.
  • I am wunsch (https://keybase.io/wunsch) on keybase.
  • I have a public key whose fingerprint is CE28 EDB9 BAD2 F531 7941 B65A 9E26 C63A DC75 6EEF

To claim this, I am signing this object: