Skip to content

Instantly share code, notes, and snippets.

mwunsch / emoji_image_replace.js
Last active February 22, 2023 19:16
Detect emoji unicode on a page, replace it with images (supplied by GitHub, for now). Goes great in your ~/.js
View emoji_image_replace.js
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
* Much of this code was gleaned from staring at the minified GitHub JS.
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
mwunsch / text_nodes.js
Last active October 30, 2022 14:48
Get the text nodes out of a document, ignoring the ones that are in Elements where the text value aren't likely to be valuable (like <script> tags) and nodes containing just whitespace.
View text_nodes.js
function getLegitTextNodes() {
if (!document.createTreeWalker) return [];
var blacklist = ['SCRIPT', 'OPTION', 'TEXTAREA'],
textNodes = [],
walker = document.createTreeWalker(
function excludeBlacklistedNodes(node) {
if (blacklist.indexOf(node.parentElement.nodeName.toUpperCase()) >= 0) return NodeFilter.FILTER_REJECT;
View jekyll-aws.rake
# Rake tasks for building a jekyll blog and deploying to S3.
# These tasks aren't intended to replace the `jekyll` executable,
# but provide convenient Rake-isms to generate the destination dir
# when necessary.
# To write to s3, it assumes there is a bucket field in the
# jekyll config:
# aws:
# bucket: 'my-s3-bucket'
mwunsch / viz.js
Created April 23, 2015 14:31
DOM -> Graphviz
View viz.js
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 | tee >(dot -Tpng > test.png)
var page = require('webpage').create();
var args = require('system').args;
mwunsch / broadcast.rkt
Last active December 22, 2020 02:08
!!con 2018 Presentation - Overscan
View broadcast.rkt
#lang overscan
(require overscan/macos
(only-in racket/file make-temporary-file)
(only-in racket/math pi)
(define cam+screen
mwunsch /
Last active June 23, 2018 17:41
Random Avatar Generator
curl -s '' | ruby -r'rexml/document' -e 'puts["tumblr/posts"]'
mwunsch /
Created March 11, 2014 17:04

Keybase proof

I hereby claim:

  • I am mwunsch on github.
  • I am 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:

mwunsch / Main.elm
Last active March 22, 2017 01:12
Elm Boilerplate
View Main.elm
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 / emoji.rb
Created October 20, 2012 03:40
emoji unicode to codes
View emoji.rb
#!/usr/bin/env ruby
"1F604" => :smile,
"1F606" => :laughing,
"1F60A" => :blush,
"1F603" => :smiley,
"263A" => :relaxed,
"1F60F" => :smirk,
"1F60D" => :heart_eyes,
mwunsch / emojiToImage.js
Created December 16, 2012 01:24
Replace emoji characters in a string with an image of said emoji.
View emojiToImage.js
// (c) 2012 Mark Wunsch
// MIT license.
if (!String.fromCodePoint) {
* ES6 Unicode Shims 0.1
* (c) 2012 Steven Levithan <>
* MIT License
String.fromCodePoint = function fromCodePoint () {