Skip to content

Instantly share code, notes, and snippets.

View straker's full-sized avatar

Steven Lambert straker

View GitHub Profile
@straker
straker / nativeDomAPI.js
Last active October 20, 2022 11:22
HTML DOM api standards proposal - examples of how the native HTML DOM api is cumbersome to use and how different libraries handle it
/**
* Create element with attributes
*
* <input type="number" min="0" max="99" name="number" id="number" class="number-input" disabled/>
*/
// native
var input = document.createElement('input');
input.type = "number";
input.min = 0;
@straker
straker / wrapper.js
Last active October 20, 2022 11:31
Simple wrapper around DOM functions to make DOM interactions a bit easier to work with
(function(Node, Element, HTMLCollection, Array) {
/**
* Wrap addEventListener to handle multiple event types and be chainable.
* @param {string} types - Space-separated event types.
* @param {function} listener
* @param {boolean} useCapture
* @returns {Node}
*
* @example
* document.querySelector('a')
@straker
straker / .babelrc
Last active October 20, 2022 12:00
Example of running axe-core using Jest and Enzyme
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
@straker
straker / two-way-binding.js
Last active October 14, 2024 19:31
Simple and small two-way data binding between DOM and data
/**
* @param {object} scope - Object that all bound data will be attached to.
*/
function twoWayBind(scope) {
// a list of all bindings used in the DOM
// @example
// { 'person.name': [<input type="text" data-bind="person.name"/>] }
var bindings = {};
// each bindings old value to be compared for changes
@straker
straker / .babelrc
Created March 7, 2022 17:34
Example of running axe-core using Jest and @testing-library/react
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
@straker
straker / README.md
Last active January 30, 2026 18:25
Basic Tetris HTML and JavaScript Game

ICE Out; Abolish ICE

Basic Tetris HTML and JavaScript Game

This is a basic implementation of the game Tetris, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

@straker
straker / README.md
Last active January 30, 2026 18:26
Basic Block Dude HTML and JavaScript Game

ICE Out; Abolish ICE

Basic Block Dude HTML and JavaScript Game

This is a basic implementation of Block Dude, an old TI-83/4 Calculator game. It's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

@straker
straker / README.md
Last active January 30, 2026 18:26
Basic Bomberman HTML and JavaScript Game

ICE Out; Abolish ICE

Basic Bomberman HTML and JavaScript Game

This is a basic implementation of the NES game Bomberman, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

@straker
straker / README.md
Last active January 30, 2026 18:26
Basic Breakout HTML and JavaScript Game

ICE Out; Abolish ICE

Basic Breakout HTML and JavaScript Game

This is a basic implementation of the Atari Breakout game, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

@straker
straker / README.md
Last active January 30, 2026 18:26
Basic Doodle Jump HTML and JavaScript Game

ICE Out; Abolish ICE

Basic Doodle Jump HTML and JavaScript Game

This is a basic implementation of the game Doodle Jump, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration