Skip to content

Instantly share code, notes, and snippets.

View Orangetronic's full-sized avatar

David Miller Orangetronic

View GitHub Profile
@Orangetronic
Orangetronic / description.md
Created May 12, 2025 11:11
Iterable Weak Set in TypeScript

Iterable WeakSet

We have WeakSet in JS now, but sometimes i've run into situations where I want to be able to iterate over a WeakSet's contents.

We can accomplish this using a regular Set holding WeakRefs, and a WeakMap to tie items themselves to their WeakRefs.

Implementation notes

This only cleans up empty WeakRefs when it is iterated, so will retain empty WeakRef items unless you iterate it sometimes.

@Orangetronic
Orangetronic / spongecase.js
Last active June 22, 2022 22:09
a crYoTPGRApHicaLly rEVeRsIBle SPoNGebOb-casE alGORiThm
/*
* Cryptographically reversible spongebob-case text transformation
*
* Sometimes you want to encode some text in a way that is not completely
* secret, but is quite hard to read. But what if you need to decode it again?
*
* Now you can!
*
* to De-sponge some text, simply pass the sponged text back through the sponge
* function
@Orangetronic
Orangetronic / autocorrects.md
Last active November 21, 2023 23:57
A list of autocorrections I have witnessed my telephone make on my behalf.

autocorrects

being a list of instances where autocorrect has mangled my meaning

  • if to orb
  • of to if
  • ill to i’ll
  • reindexes to Reindeer’s
  • already visited to pressured visiting
  • colour to collie
  • this to these
@Orangetronic
Orangetronic / vec2 stuff
Created November 21, 2020 23:35
Dump this in an iOS playground, and click around to simulate what would be index finger point tracking
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
import CoreGraphics
import simd
/// # Some Convencience Extensions
@Orangetronic
Orangetronic / description.md
Last active May 30, 2019 15:49
use-pausable-timeout

This is a React hook that creates a timeout, and provides functions for pausing, resuming, and resetting that timeout.

@Orangetronic
Orangetronic / for_each_db.js
Created May 30, 2019 13:10
run a command across all the databases in mongo from the Studio 3T mongo shell
db = db.getSiblingDB("admin");
dbs = db.runCommand({ "listDatabases": 1 }).databases;
// Iterate through each database and get its collections.
dbs.forEach(function(database) {
db = db.getSiblingDB(database.name);
});
@Orangetronic
Orangetronic / iterable-tree.md
Last active May 21, 2019 10:05
Iterable tree class by @Orangetronic

Instantiate this class around a tree-like object, e.g.

const filetree = new IterableTree({
  name : "Desktop",
  children : [
   { name : "funny.gif" },
   { name : "resume.pdf" },
   { name : "memes",
     children : [
 { name : "distracted-boyfriend.png" },
/*
ADD THESE LINES TO YOUR SITE'S STYLESHEETS TO HIDE THE GENIUS WEB ANNOTATOR STUFF.
*/
genius-back-page, genius-back-page-mobile-clickjacker, genius-pre-annotation-prompt {
display: none;
visibility: hidden;
opacity: 0;
position: absolute;
left: -10000px;

RESUMÉ: David Miller

Profile

Designer/developer fascinated by the promise of the web. Front end proficiency strong. Some excursions through full-stack development/deployment. Four years running successful freelance business. Youth educator in media-literacy focussed summer program. Fascinated by the way we use technology to engage with the world around us. Philosophy B.A. with breadth and depth of hands-on technical experience in design, complex problem-solving and analysis, and online technologies. Managerial and team experience as editor of student publications. Occasional musician.

Professional Experience

Freelance designer/developer, orangetronic.com — 2006 - present

@Orangetronic
Orangetronic / mod_rewrite gold
Last active December 22, 2015 23:49
Helpful mod_rewrite snippets: 1. Apache mod_rewrite rule to fake virtualhost in shared hosting environments where apache config files are not accessible.
RewriteCond %{HTTP_HOST} ^mydomainname\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomainname\.com$
RewriteCond %{REQUEST_URI} !^/subfoldername/
RewriteRule (.*) /subfoldername/$1
#from http://stackoverflow.com/a/11090555/2776197