Skip to content

Instantly share code, notes, and snippets.

nbogie /
Created Jun 17, 2011
script to syntax-check puppet .pp and .erb files
#Script to test puppet files have valid syntax.
#Intended for use with hudson/jenkins.
set -e
set -u
#TODO: Run these in parallel - we have 4 cores.
#TODO: Control the environment (through the config dir?).
nbogie / midipipe-amazon-music-control.applescript
Created Feb 16, 2017
simple applescript for midipipe, to allow MIDI control of amazon music player in Chrome
View midipipe-amazon-music-control.applescript
on isMidiButtonPressed(msg, bNumber)
return ((item 1 of msg = 191) and (item 2 of msg = bNumber) and (item 3 of msg > 0))
end isMidiButtonPressed
on jsClick(theTab, sel)
tell application "Google Chrome"
execute theTab javascript ("document.querySelector('" & sel & "').click()")
end tell
end jsClick
nbogie / DumpObjectToConsoleForThree.js
Created Nov 9, 2020
utility functions to report structure of scene / sub-scene to console, for three.js (at least for gltf-loaded-models). by@greggman
View DumpObjectToConsoleForThree.js
import * as THREE from '';
function dumpObjectToTextLines(obj, lines = [], isLast = true, prefix = '') {
if (!obj || !obj.children) {
return lines;
const localPrefix = isLast ? '└─' : '├─';
lines.push(`${prefix}${prefix ? localPrefix : ''}${ || '*no-name*'} [${obj.type}]`);
const newPrefix = prefix + (isLast ? ' ' : '│ ');
const lastNdx = obj.children.length - 1;
nbogie / recipe.json
Last active Nov 3, 2020
cyf - example recipe for recipe API
View recipe.json
"title": "Adana",
"ingredients": [
"1 kg ground lamb",
"Kosher salt",
"4 teaspoons ground cumin, divided",
"4 tablespoons ground sumac, divided",
"4 tablespoon ground Urfa pepper flakes, divided",
"4 tablespoons ice-cold water"

Getting create-react-app working on Ubuntu (19.04)

problems and solutions

Main success conditions to be met:

We will be done if...

  • npx create-react-app is runs and completes successfully
  • student can run the react app created by the above
nbogie / SimpleAesonJsonExample.hs
Created May 22, 2011
Simplest Aeson json parsing and generation example
View SimpleAesonJsonExample.hs
{-# LANGUAGE OverloadedStrings #-}
-- This is a very simple example of parsing and generating json with Aeson,
-- by a haskell newbie and intended for newbies.
-- This almost certainly contains a number of bad practices. It works for
-- me and hopefully will get you started.
-- I couldn't find a stand-alone example of Aeson usage and found it tricky to
-- get going. For example, if you don't realize to enable the language extension
View stacked-layers-shader.shadertoy
// Trying to build stacked crosssectional plates of animated 3d noise, to mimic this work:
// Using the noise algorithm from this shader by iq:
// then making it have octaves.
// TODO: Make the plates square and isometric.
// TODO: Fix the noise so that builds in from both up as well as down.
// TODO: Correctly just overlay the colours of each upper disc on the lower discs, if the upper pixel is not transparent. Need to model alpha.
// TODO: don't calculate a noise value that is going to be thrown away!
nbogie /
Last active Jun 5, 2020
student issues: react week 3

React week 3 - student questions and issues for class

  • setFoo doesn't magically update foo (useState):
  • useState("someinitvalue") only initialises the variable the first time the component is ?rendered?. Subsequent calls to useState return the new current value of the variable.
  • passing props down and down. useContext? "
    • should I learn redux?
  • "should i learn class components?"
  • to investigate: synthetic events an issue?