Skip to content

Instantly share code, notes, and snippets.


Jake Teton-Landis justjake

View GitHub Profile
justjake / server-preload.js
Last active January 31, 2023 13:29
Customizing NextJS for error reporting and Datadog APM (dd-trace) integration. See
View server-preload.js
// @ts-check
"use strict"
* Set up datadog tracing. This should be called first, so Datadog can hook
* all the other dependencies like `http`.
function setUpDatadogTracing() {
const { tracer: Tracer } = require('dd-trace')
const tracer = Tracer.init({
justjake / style-props.tsx
Last active October 29, 2019 00:11
Exploring building a CSS-in-JS system in Typescript
View style-props.tsx
import { CSSProperties, Component } from "react"
* Base types.
* A SheetProducer makes a sheet based on a context.
* Right now, the context only contains a `theme`.
justjake /
Created December 9, 2015 23:27
find bad packages in sinopia


I noticed a bunch of packages triggering [this npm@3 issue] because our Sinopia instance cached a number of packages. I wrote this script to find the bad packages on our server.


  1. npm install
  2. change the dataDir variable on line 3 of index.js to point to your Sinopia data directory
  3. run node ./index.js | grep BAD to list the bad packages
  4. rm -r those packages
justjake / fuck-me.js
Created August 26, 2015 08:21
4chan tried to make a monopoly game in a live codepad
View fuck-me.js
// install gentoo
const clover = '//';
// @param {String} url - load image from here
// @return {Promise<Sprite>} herp derp
function loadSprite(url) {
return new Promise((resolve, reject) => {
const img = new Image();
justjake / swag.log
Created August 23, 2015 05:51
output of exeriment for compiling mardown to other markdown
View swag.log
> airbnb-style@2.0.0 script /home/justjake/src/javascript
> babel-node ./script/index.js
# Destructuring
## Use object destructuring when accessing and using multiple properties of an object.
justjake /
Created December 25, 2014 17:20
Dispelling some myths

Cut fruit looses nutrition? Not significantly.

Cut fruit looses about 10% to 25% of its vitamin C and other oxidizing nutrients after 6 days in refrigeration; it visibly spoils before nutrition loss is significant. Most oft-cited paper with this result is Quality Changes and Nutrient Retention in Fresh-Cut versus Whole Fruits during Storage (American Chemical Society), you cans find a brief summary from the NYT Nutrition desk here:, and a google search for "cut fruit loses nutrition" has top results mostly pointing to that study. An argument can be made for pre-cut vegetables and fruits being less tasty after a week of near-freezing refrigeration, but this "4 hours" thing is malarky.

Vitamin C reacts with "metal" to become useless? No.

I found a few articles discussing vitamin C reacting with free iron & copper in a H2O2 (hydrogen peroxide) solution to become a free r

justjake /
Last active August 29, 2015 13:57
Convert Titanfall end-of-game scoreboards into text files
# Converts a titanfall scoreboard from any image format into a TXT document
# Uses imagemagick for image magick (apt-get install imagemagick)
# Uses tesseract for OCR (apt-get install tesseract-ocr)
set -e
justjake /
Last active December 30, 2015 07:59
Power of anonymous functions

The relevent bits

Plotting from euclidean space to screen coordinates in Coffeescript, for my Spectrograph class

plot: (width, height, max_Y) ->
 # re-generate coeficceint functions
 if ! (@_width == width && @_height == height && @_max_Y == max_Y)
   w_coef = width / SIZE
   h_coef = height / max_Y # consider changing this to absolute w/height? nah
   # @X and @Y transform normal euclidean X, Y points into screen X Y points
justjake /
Last active December 30, 2015 05:38
Line drawing demo. Use with Coffeescript mode in Processing 2
setup: ->
# Processing.js setup
size(1600, 900)
class Point
constructor: (@x, @y) ->
sub: (other) ->
new Point(@x - other.x, @y - other.y)
magnitude: ->
justjake / format.js
Last active December 16, 2015 22:29
View format.js
update = {
/* Two basic sections. */
"Nodes": {
/* Nodes is a int->node map.
* nodes that already exist are updaasdted
* by the fields supplied in the Nodes section
* delete a node by passing `null` or a string as the value
* id, name, class fields required for new node creationjsdfA
* */