Skip to content

Instantly share code, notes, and snippets.

View sjshuck's full-sized avatar

Steve Shuck sjshuck

  • KeyBank
  • Cleveland, Ohio
View GitHub Profile
@sjshuck
sjshuck / Trie.hs
Created May 3, 2024 18:45
Trie in Haskell, using lens
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
module Data.Trie (
Trie,
singleton,
insert,
delete,
@sjshuck
sjshuck / things.py
Created March 26, 2024 03:49
dataclass-wizard demo
#! /usr/bin/env python3
from dataclasses import dataclass, field
from typing import List
from dataclass_wizard import YAMLWizard
@dataclass
class Thing(YAMLWizard):
@sjshuck
sjshuck / maps.xml
Last active January 20, 2024 02:32
XML is so...powerful 😒
<!-- Each entry is a child, which has a key child and a val child -->
<map>
<entry>
<key>foo</key>
<val>bar</val>
</entry>
<entry>
<key>baz</key>
<val>qux</val>
</entry>
@sjshuck
sjshuck / try_require.lua
Last active March 14, 2023 17:25
try_require
function try_require(module_name)
local success, module = pcall(require, module_name)
local first_time = true
return function()
if success and first_time then
first_time = false
return module
end
end