Skip to content

Instantly share code, notes, and snippets.

View awreese's full-sized avatar

Drew Reese awreese

View GitHub Profile
@awreese
awreese / Dictionary.java
Last active December 8, 2016 17:19 — forked from prettymuchbryce/Dictionary.java
Dictionary with trie tree Java
//Dictionary implemented using a Trie Tree.
public class Dictionary {
private HashMap<Character,Node> roots = new HashMap<Character,Node>();
/**
* Search through the dictionary for a word.
* @param string The word to search for.
* @return Whether or not the word exists in the dictionary.
*/
public boolean search(String string) {
@awreese
awreese / CastleDB HaxeFlixel Intagration.md
Last active December 20, 2021 05:38
CastleDB integration into HaxeFlixel Project (HaxeDevelop, HTML5)

After following the castledb haxelib package installation instructions...

Steps:

  1. From HaxeDevelop, Project->New Project, select 'HaxeFlixel Project'

  2. Open CastleDB, create/edit sheets, save into 'assets/data/XXX.cdb' where XXX is your db name

  3. Create 'Data.hx' file per the castledb instructions with the following line:

private typedef Init = haxe.macro.MacroType &lt; [cdb.Module.build("assets/data/XXX.cdb")] &gt; ;

@awreese
awreese / useCancellableFetch.js
Last active October 5, 2022 23:35
Cancellable Fetch React Hook
import { useEffect } from "react";
/**
* Cancellable Fetch request decorator - Higher Order Function
* --
* Decorates a standard fetch request with an AbortController's signal
* included with the fetch options.
*
* Based, in part, upon Oleg Lytvyn's ["How you can abort Fetch() request on a flight…" article](https://itnext.io/how-you-can-abort-fetch-request-on-a-flight-830a639b9b92)
*