Skip to content

Instantly share code, notes, and snippets.

perey /
Created Apr 10, 2022
Browser Gamepad API test and example

Firefox 98:

  • navigator.getGamepads() only contains Gamepad objects, and only for gamepads that are actually connected.
  • When handling a gamepadconnected event, the event's gamepad property is a live reference to the gamepad in question. It can be saved and used to check for future changes to the gamepad state.
  • While handling a gamepaddisconnected event, the array obtained from navigator.getGamepads() will still include the gamepad being disconnected, but will report it as having 0 buttons and 0 axes.
  • I have only ever seen index 0 be assigned to the first-connected gamepad.

Chrome 100:

  • navigator.getGamepads() contains four items, which are null until a gamepad is actually connected. (I expect this is a minimum and the array will expand if you connect five or more gamepads, but I haven't tested it.)
perey / korean_testcases.csv
Created Feb 10, 2018
Test cases for romanising Korean
View korean_testcases.csv
Hangul Latin Comments
gak Initial and final ㄱ, vowel ㅏ
kkaek Initial and final ㄲ, vowel ㅐ
nyan Initial and final ㄴ, vowel ㅑ
dyaet Initial and final ㄷ, vowel ㅒ
tteo Initial ㄸ, vowel ㅓ
rel Initial and final ㄹ, vowel ㅔ
myeom Initial and final ㅁ, vowel ㅕ
byep Initial and final ㅂ, vowel ㅖ
ppo Initial ㅃ, vowel ㅗ
perey / resource.svg
Created Oct 21, 2017
Test case for styling of SVG <use> element referencing an external file
View resource.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View nearest_stars.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>A star map</title>
html {
background-color: black;
perey / challenge_mondrian_results.txt
Last active Dec 20, 2016
Mondrian Puzzle in Piet
View challenge_mondrian_results.txt
? 200
| |
| |
| |
| |
| |
| |
| |
| |
#!/usr/bin/env python3
"""Line-art painter."""
# Copyright © 2016 Timothy Pederick.
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to

Hello World

The Esolang wiki version



perey /
Created Sep 18, 2015
Hexagon maker for "Beatles Songs and Hexagons" challenge
#!/usr/bin/env python3
"""Triangular code checker and hexagon builder.
When run from the command line, this program accepts two filenames as
arguments. It will:
a) Check that they conform to the format specified in the challenge
b) Merge them into a hexagon and print the result to STDOUT
perey / fraction.chef
Last active Aug 29, 2015
Chef code for converting improper fractions to mixed numbers.
View fraction.chef
Fraction Dosa.
This recipe takes a numerator and denominator from STDIN and outputs the
mixed-number representation to STDOUT.
2 cups numerator rice
2 cups denominator ukda chawal
1 cup whole part urad dal
10 teaspoons new line poha
perey /
Last active Aug 29, 2015
Langford sequence coding challenge
#!/usr/bin/env python3
"""Daily Programmer Challenge #224 [Hard] Langford Strings
from string import ascii_uppercase
from copy import copy