Skip to content

Instantly share code, notes, and snippets.

View z5h's full-sized avatar
🕳️

Mark Bolusmjak z5h

🕳️
View GitHub Profile
@z5h
z5h / Makefile
Created July 18, 2025 16:24 — forked from bwhitman/Makefile
playdate running AMY
HEAP_SIZE = 8388208
STACK_SIZE = 61800
PRODUCT = HelloWorld.pdx
# Locate the SDK
SDK = ${PLAYDATE_SDK_PATH}
ifeq ($(SDK),)
SDK = $(shell egrep '^\s*SDKRoot' ~/.Playdate/config | head -n 1 | cut -c9-)
endif
@z5h
z5h / d01.pl
Last active December 9, 2024 16:45
Advent of Code 2024 in Prolog
% -*-Prolog-*-
:- module(d01, [
a/0,
b/0
]).
:- use_module(library(pio)).
:- use_module(library(dcg/basics)).
a :-
phrase_from_file(lists(L1, L2), '1/inputa.txt'),
@z5h
z5h / example.pl
Created December 6, 2023 06:00
"Monte-Carlo amb" in Prolog, proof of concept
amb_example(BestGuess) :-
run_with_monte_carlo_amb(1000,
( amb(BestGuess, [2,3,4,5,6,7,8,9,10,11,12]),
guess_the_dice_total(BestGuess)
)).
guess_the_dice_total(Total) :-
random_member(Dice1, [1,2,3,4,5,6]),
random_member(Dice2, [1,2,3,4,5,6]),
(Total =\= Dice1 + Dice2 -> amb(fail); true).
@z5h
z5h / Kernel.elm
Created May 8, 2023 14:35
Updated microKanren Kernel
-- modified version of https://package.elm-lang.org/packages/dvberkel/microkanren/latest/
-- fixing a bug, and adding reification, some practical features, and an example logic problem
module MicroKanren.Kernel exposing
( Goal, State, Stream(..), Term(..), Var
, callFresh, conjoin, disjoin
, emptyState, unit
, walk
, Substitutions, fish, l, pull, unify, v
)
@z5h
z5h / Example.elm
Last active November 23, 2020 13:10
Elm focusout focusin
import Browser.Dom
import Element exposing (Element)
import Element.Background as Background
import Element.Border as Border
import Element.Font as Font
import Element.Input as Input
import Html
import Html.Attributes
import Html.Events
import Json.Decode as Decode
@z5h
z5h / Main.elm
Created February 1, 2020 16:27
transition animations
module Main exposing (..)
import Browser
import Html exposing (Html, button, div, span, text)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
import Timeline exposing (Timeline)
module Base.ListSet exposing
( Set
, diff
, empty
, filter
, foldl
, foldr
, fromList
, group
, insert
@z5h
z5h / Example.elm
Last active December 20, 2018 14:08
autofocus in Elm that actually works
input [
focus (item.id) (RequiresFocus_ Nothing)
else
none
]
import Stopwatch
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (..)
main: Program Never
main =
App.program
{ init = init
module TimeApp ( start, Config, App ) where
{-| This module helps you start your application in a typical Elm workflow.
It assumes you are following [the Elm Architecture][arch] and using
[elm-effects][]. From there it will wire everything up for you!
**Be sure to [read the Elm Architecture tutorial][arch] to learn how this all
works!**
[arch]: https://github.com/evancz/elm-architecture-tutorial
[elm-effects]: http://package.elm-lang.org/packages/evancz/elm-effects/latest