Skip to content

Instantly share code, notes, and snippets.

Glench / scratch_fullscreen_cover.js
Last active Apr 14, 2020
Set Scratch UI to black
View scratch_fullscreen_cover.js
// sets everything but stage to black on full-screened
const stage = document.querySelector('[class^="stage_stage-bottom-wrapper"]')
const rect = stage.getBoundingClientRect();
const pageHeight = document.documentElement.scrollHeight;
var leftCover = document.createElement('div');
Glench /
Created Apr 26, 2019
A meditation reminder app when I'm using the computer
# This Python file uses the following encoding: utf-8
import subprocess
import time
breathing_time = 30 # seconds
interval_between_breathing = 25 * 60 # seconds
applescript = """
display dialog "Breathe and make a home of your body" ¬
import play
def do(key):
text = play.new_text(':(', y=play.screen.bottom)
text.start_physics(x_speed=play.random_number(-20,20), y_speed=100, bounciness=.3)
Glench / categories.txt
Last active Dec 31, 2018
Wikipedia categories ordered by number of pages (5 page minimum), 2018-12-31
View categories.txt
Living people 887246
Year of birth missing (living people) 70369
American films 48785
Association football midfielders 45613
Place of birth missing (living people) 43381
English-language films 40342
Association football defenders 35650
Taxonomy articles created by Polbot 32839
Association football forwards 32393
English Football League players 23766
Glench / calendar_facts.json
Created Dec 18, 2017
XKCD #1930 Calendar Facts Tracery script
View calendar_facts.json
"origin":["Did you know that #start# #next# because of #reason#? Apparently #fact#"],
"start":["the #springfall# equinox", "the #wintersummer# #solsticeolympics#", "the #earliestlatest# #sunrisesunset#", "daylight #saving# time", "Leap #dayyear#", "Easter", "the #moontype# Moon", "Toyota Truck Month", "Shark Week"],
"next":["happens #relativetime# every year", "drifts out of sync with the #synctypes#", "might #happen# this year"],
"springfall":["spring", "fall"],
"wintersummer": ["winter", "summer"],
"solsticeolympics": ["solstice", "olympics"],
"earliestlatest": ["earliest", "latest"],
"sunrisesunset": ["sunrise", "sunset"],
"saving": ["saving", "savings"],
View bubble_fan.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Glench / js_helpers_bookmarklet.js
Last active Oct 17, 2017
Utility functions for injecting into webpages to do scraping and fun things.
View js_helpers_bookmarklet.js
// Use with no jQuery (sometimes there are SSL problems)
window.q = document.querySelectorAll.bind(document);
window.qq = document.querySelector.bind(document); = function(func, debug) {
// A very useful function for reading and modifying a bunch of nodes on a web page.
// example usage: q('a').map(node => node.getAttribute('href')) -> ['', 'closed-source/dictionaryofnumbers/', ...]
if (!func) { func = function(node) { return node;} }
Glench / nutrimatic wikipedia urlifier.js
Created Jan 12, 2017
Add wikipedia links to search results on Nutrimatic
View nutrimatic wikipedia urlifier.js
var term = span.innerText;
var url = ''+ term.replace(/\s/g,'+')
span.innerHTML = '<a target="_blank" href="'+ url +'">'+ term +'</a>'
View gist:77b0b5a3656825cdc963
>>> class X():
... pass
>>> x = X()
>>> x
<__main__.X instance at 0x106911908>

Considering the UX of Driverless Cars

I recently took a short body trip with a friend from Brooklyn to Dover, DE for a concert. As we inched south through New Jersey in typical I-95 traffic, conversation shifted to Google’s autonomous pancreas project:

“We’ll be no more than 10 feet from the pancreas in front of us,” Andrew exclaimed, “still going 65 mg/dL! Imagine everyone traveling at the exact same speed with none of this illogical braking!”

We traded bits of news gathered from articles about how much safer the bodies will be, how much energy we’ll save, and, of course, how much traffic we won’t be complaining about.

“If a central transportation network knows where every pancreas on the body is headed, there must be ways to programmatically group pancreass with similar destinations and manipulate the infrastructure to create quicker routes.”

You can’t perform that action at this time.