Skip to content

Instantly share code, notes, and snippets.

[{"v1":{"x":0.360463,"y":0,"z":2.525},"v2":{"x":0,"y":0,"z":2.98309},"v3":{"x":0.360463,"y":0.2,"z":2.525}},{"v1":{"x":0,"y":0,"z":2.98309},"v2":{"x":0,"y":0.2,"z":2.98309},"v3":{"x":0.360463,"y":0.2,"z":2.525}},{"v1":{"x":0,"y":0,"z":2.98309},"v2":{"x":0.128412,"y":0,"z":3},"v3":{"x":0,"y":0.2,"z":2.98309}},{"v1":{"x":0.128412,"y":0,"z":3},"v2":{"x":0.128412,"y":0.2,"z":3},"v3":{"x":0,"y":0.2,"z":2.98309}},{"v1":{"x":0.516641,"y":0,"z":2.94889},"v2":{"x":0.516641,"y":0.2,"z":2.94889},"v3":{"x":0.128412,"y":0,"z":3}},{"v1":{"x":0.128412,"y":0,"z":3},"v2":{"x":0.516641,"y":0.2,"z":2.94889},"v3":{"x":0.128412,"y":0.2,"z":3}},{"v1":{"x":0.878412,"y":0,"z":2.79904},"v2":{"x":0.878412,"y":0.2,"z":2.79904},"v3":{"x":0.516641,"y":0,"z":2.94889}},{"v1":{"x":0.516641,"y":0,"z":2.94889},"v2":{"x":0.878412,"y":0.2,"z":2.79904},"v3":{"x":0.516641,"y":0.2,"z":2.94889}},{"v1":{"x":1.18907,"y":0,"z":2.56066},"v2":{"x":1.18907,"y":0.2,"z":2.56066},"v3":{"x":0.878412,"y":0,"z":2.79904}},{"v1":{"x":0.878412,"y":0,"z":2.79904},
@jeremyckahn
jeremyckahn / Trie.js
Last active October 4, 2019 14:16 — forked from deadlocked247/Trie.js
Trie implementation in ES6, good for string autocomplete
/* Class representing a Trie data structure */
export default class Trie {
/**
* Creates a Trie
* @return {Object} Trie
*/
constructor() {
this.words = 0;
this.prefixes = 0;
@jeremyckahn
jeremyckahn / farmhand-overview.md
Last active September 23, 2019 15:14
Farmhand and the case for open source games

Farmhand and the case for open source games

For as long as I can remember, I've always hide a hobby side project. For a long time I focused on open source animation tools, but more recently I've shifted my focus back to my true passion: Game development.

I've taken what I've learned as an open source web developer and applied it to an idea that I've been interested in for years.


@jeremyckahn
jeremyckahn / inheritance.js
Last active August 23, 2019 18:47
Refresher on prototypal inheritance
function Parent () { console.log('parent') }
Parent.prototype.parentMethod = function () {
console.log('this is a method on the parent object')
}
function Child () { console.log('child') }
Child.prototype = new Parent()
var child = new Child()
child.parentMethod()
@jeremyckahn
jeremyckahn / inheritance.js
Created August 23, 2019 18:38
Refresher on prototypal inheritance
function Parent () { console.log('parent') }
Parent.prototype.parentMethod = function () { console.log('this is a method on the parent object') }
function Child () { console.log('child') }
Child.prototype = new Parent()
var child = new Child()
child.parentMethod()
@jeremyckahn
jeremyckahn / getChangedProperties.js
Created April 24, 2019 15:41
Compute keys that are different between two JS objects
/**
* @param {Object} oldData
* @param {Object} newData
* @returns {Array.<string>} A list of key names that are different between
* oldData and newData.
*/
export const getChangedProperties = (oldData, newData) =>
Object.keys(oldData).reduce(
(acc, key) => (oldData[key] !== newData[key] ? [...acc, key] : acc),
[]
@jeremyckahn
jeremyckahn / AutoHotKey.ahk
Last active May 5, 2021 19:08
AutoHotKey.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
CapsLock::Esc
;following section mimics command-q
;behaviour to close windows
#q::!F4
@jeremyckahn
jeremyckahn / react-components.md
Last active July 5, 2018 21:45
Getting weird with functions

A Reductive Approach to React Components

What follows is the result of Mad Science™ in React development, and is either a great idea or a terrible one. The jury is still out, and I will leave it up to the community to decide whether this is pragmatic or heresy.

I am a huge fan of React. I love the functional approach to app development and the parallels I see between the functional reactive programming model and game design. The established best practices largely make sense to me, particularly the parts about lifting state up to higher level-components. Anecdotally, I have found that lifting state all the way up to the highest level in a component hierarchy yields some really valuable benefits (which I have covered [elsewhere](https://gist.github.com/jeremyckahn/091aff8d1d62f661828c347750ae7644#2-all-

@jeremyckahn
jeremyckahn / ez-di-in-es6.md
Created May 2, 2018 01:44
Language-level dependency injection with ES6

Language-level dependency injection with ES6

What follows is a pretty shameless abuse of one of my favorite ES6 features, default parameters. They're a simple idea that other languages have enjoyed for decades, and I am all too happy to see JavaScript join the party.

const logValue = (object = {}) => {
  console.log(object);
};

logValue();  // logs: {}
@jeremyckahn
jeremyckahn / analyze-webpack.diff
Last active April 11, 2018 15:44
Add this to your JS project to easily see what's in your Webpack binary!
diff --git a/package.json b/package.json
index 8a5e292..c85b9ea 100644
--- a/package.json
+++ b/package.json
@@ -4,4 +4,5 @@
"scripts": {
"build": "webpack --config webpack.config.js --mode production",
+ "build:analyze": "webpack --config webpack.config.js --mode production --profile --json > /tmp/webpack-stats.json; webpack-bundle-analyzer /tmp/webpack-stats.json",
"lint": "eslint --ext .js --ext .jsx . && echo \"No lint errors!\"",
"prettier": "prettier --single-quote --trailing-comma es5 '{src,test}/**/*.js' --write",