View scrape_mdn.rb
#!/usr/bin/env ruby
# Scrape the JavaScript documentation on Mozilla Developer and store an index
# as a YAML file.
# The data is organized by "token." If someone hits ^H in the middle of the
# word "toUpperCase", we want to link them to the MDN page for
# `String.prototype.toUpperCase`. If they're in the middle of the word
# "indexOf", we want to let them choose between `Array.prototype.indexOf` and
# `String.prototype.indexOf`.
View assign-categories
#!/usr/bin/env ruby
require 'pathname'
require 'inifile'
require 'nokogiri'
rescue LoadError => e
puts "This script requires nokogiri and inifile:"
puts " $ gem install nokogiri inifile"
View joystick-type
#!/usr/bin/env ruby
require 'io/console'
require 'json'
require 'optparse'
require 'pathname'
$opts = do |opts|
opts.banner = "Usage: joystick-type [options] system game\nReturns the type of joystick for the given system and game."
opts.separator ""
View led-end
#!/usr/bin/env ruby
# For now, let's just turn all LEDs back on.
exec(%Q[/home/pi/bin/pacdrive -a -q])

Using a rotary encoder as a volume control

On my RetroPie machine I wanted a hardware volume knob — the games I play use a handful of emulators, and there's no unified software interface for controlling the volume. The speakers I got for my cabinet are great, but don't have their own hardware volume knob. So with a bunch of googling and trial and error, I figured out what I need to pull this off: a rotary encoder and a daemon that listens for the signals it sends.

Rotary encoder

A rotary encoder is like the standard potentiometer (i.e., analog volume knob) we all know, except (a) you can keep turning it in either direction for as long as you want, and thus (b) it talks to the RPi differently than a potentiometer would.

I picked up this one from Adafruit, but there are plenty others available. This rotary encoder also lets you push the knob in and treats that like a button press, so I figured that would be useful for toggling mute on and off.


RetroPie, LED control, and you

I wanted LEDBlinky-style functionality out of my RetroPie cabinet. But I didn't need RGB control or magical frontend integration or anything like that. I had buttons with simple single-color LEDs.

I've got a simple control panel with six buttons per player. All I wanted was this:

  • When I launch Street Fighter 2, all twelve buttons should light up.
  • When I launch The Simpsons, only the first two buttons for each player should light up.
  • When I launch Pac-Man, none of the buttons should light up.
View Drag and drop styling
.dropzone {
background-color: #ccc;
width: 100%;
height: 200px;
border: 2px dashed #666;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: inset 2px 2px 10px 2px rgba(0, 0, 0, 0.5);
View default.css
/* Mono by Christopher Lobay is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. To view a copy of this license, visit or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. */
body, html {
text-rendering: optimizeLegibility;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
body:hover {
-webkit-transition: all 0.3s ease;
opacity: 1 !important;
View forum-f3-t19.html
<title>Test page</title>
<script type="text/javascript">
if (HTMLDivElement) { = function() { alert('aha!'); };
View gist:648005
Tools by Andrew Dupont begins here.
Book 1 - Stuff
Chapter 1 - Generic Objects
Section 1 - Unscrewing
A thing can be unscrewable. A thing is usually not unscrewable.
A thing can be screw-removing. A thing is usually not screw-removing.