Skip to content

Instantly share code, notes, and snippets.

View frankhale's full-sized avatar
🎮
writing games

Frank Hale frankhale

🎮
writing games
View GitHub Profile
@kitsonk
kitsonk / lodash_example.ts
Last active August 18, 2020 18:10
An example of using lodash under Deno in a type safe way.
// @deno-types="https://unpkg.com/@types/lodash@4.14.135/index.d.ts"
import * as lodash from "https://cdn.pika.dev/lodash-es@^4.17.15";
console.log(Object.keys(lodash));
# Credit for this: Nicholas Swift
# as found at https://medium.com/@nicholas.w.swift/easy-a-star-pathfinding-7e6689c7f7b2
from warnings import warn
import heapq
class Node:
"""
A node class for A* Pathfinding
"""
@gkaemmer
gkaemmer / Elixir_Supervision_Trees.md
Last active December 18, 2023 14:37
Quick guide to creating Elixir supervision trees from scratch

Elixir Supervision Trees Made Easy

I started with Elixir just a couple weeks after the switch from 1.4 to 1.5, so the bulk of online resources were out of date (or at least resulted in deprecation warnings). This guide is for defining Elixir 1.5 supervised modules.

It's not actually terribly complicated. It's just sometimes unclear from examples what's implemented by the language and what you actually have to implement yourself.

Say we want a supervision tree like this (where each atom is a process):

    :a

/ \

@frankhale
frankhale / IF-NOTES.txt
Last active March 21, 2017 14:44
IF NOTES
***The 'properties' property is for anything that is game specific***
-IF SCHEMA BELOW-
Player
- current room
- moves
- score
- items
- properties (eg. health, gold, etc...)
@daviwil
daviwil / 003_1_initial_code.fs
Created August 26, 2016 14:03
Source code from Episode 003 of the_dev_aspect
//
// --------- Model ---------
//
type Details =
{ Name: string
Description: string }
type Item =
{ Details: Details }
@frankhale
frankhale / youtube-search.js
Last active July 7, 2016 18:09
Proposed fix for issue #15 on YouTube Search
var querystring = require('querystring')
var xhr = require('xhr')
if (!xhr.open) xhr = require('request')
var allowedProperties = [
'fields',
'channelId',
'channelType',
'eventType',
@frankhale
frankhale / text-adventure-data-format.txt
Last active November 6, 2015 18:15
A pseudo data format for a hypothetical text adventure game engine (I'm assuming stuff which is not shown or documented yet)
text
1 You are in the Foyer of the Opera House. This room has doors to the south and
1 west, also an unusable exit to the north. The room is quiet and you don't see
1 anyone around.
2 You are in the cloak room. The room resembles a large walk in closet. You see
2 a brass hook on the wall.
3 You are in the bar and it is extremely dark, you cannot see anything right
3 now. You can't even see if there is a light switch.
4 You take off your cloak and hang it up on the hook.
6 Because you disturbed the room while moving around in the dark you made the
@frankhale
frankhale / cloak-of-darkness.txt
Last active November 6, 2015 00:00
A hypothetical data file for an interactive fiction engine capable of playing a Cloak of Darkness clone
rooms
1 Opera House Foyer
1 You are in the Foyer of the Opera House. This room has doors to the south and
1 west, also an unusable exit to the north. The room is quiet and you don't see
1 anyone around.
2 Cloak Room
2 You are in the cloak room. The room resembles a large walk in closet. You see
2 a brass hook on the wall.
3 The Bar
3 You are in the bar and it is extremely dark, you cannot see anything right
@bhauman
bhauman / core.cljs
Last active August 16, 2022 12:08
Helpful patterns when developing with ClojureScript Figwheel and Express js
(ns todo-server.core
(:require
[cljs.nodejs :as nodejs]
[figwheel.client :as fw]))
(nodejs/enable-util-print!)
(defonce express (nodejs/require "express"))
(defonce serve-static (nodejs/require "serve-static"))
(defonce http (nodejs/require "http"))
@mandulaj
mandulaj / fake.js
Created January 25, 2015 15:05 — forked from kentcdodds/fake.js
var colors = [
'rgb(30, 104, 35)', 'rgb(68, 163, 64)', 'rgb(140, 198, 101)', 'rgb(214, 230, 133)', 'rgb(238, 238, 238)'
];
var days = $('.js-calendar-graph-svg').find('rect.day');
days.css({
fill: colors[4]
});
days.on('click', function(e) {
e.stopPropagation();
$this = $(this);