Skip to content

Instantly share code, notes, and snippets.

@mattpolzin
mattpolzin / main.swift
Created February 29, 2024 23:17
attempted_repro
// The Swift Programming Language
// https://docs.swift.org/swift-book
import JSONAPI
import JSONAPIResourceCache
import Foundation
extension Include13: CacheableResource where
A: CacheableResource,
B: CacheableResource,
@mattpolzin
mattpolzin / Makefile1
Created November 24, 2023 05:09
Transitive dependency outputs
idris2 = idris2
idris-adds-version = 0.3.0
idris-json-version = 0.5.0
idris-json-hash = 2e54a37ed3c35c2d12c8927c923ad253355812a8
idris-elab-util-version = 0.6.0
idris-elab-util-hash = 2fc2d188640ce6822b5e250db73b62f5a952ca4d
idris-parser-version = 0.1.0
idris-parser-hash = 0fde36cf11c12a61edcfe09d585c5a60426bc706
@mattpolzin
mattpolzin / concath.idr
Last active November 19, 2023 06:22
Idris concatH via imapProperty
import Data.Vect
import Data.Vect.Quantifiers
%hide intersperse
-- Redefine intersperse since the prepackaged version is not
-- public export
intersperse : (sep : a) -> (xs : Vect len a) -> Vect (len + pred len) a
intersperse sep [] = []
@mattpolzin
mattpolzin / CLI output
Created May 25, 2023 23:34
Garden Bonsai PVC error minimal reproduction
~/staging/tmp (main) $ garden validate
Validate ✔️
Garden v0.13 (Bonsai) is a major release with significant changes. Please help us improve it by reporting any issues/bugs here:
https://go.garden.io/report-bonsai
→ Run garden util hide-warning 0.13-bonsai to disable this warning.
ℹ garden → Running in Garden environment dev.dev-mattpolzin
ℹ providers → Getting status...
✔ providers → Cached (took 1.8 sec)
ℹ providers → Run with --force-refresh to force a refresh of provider statuses.
@mattpolzin
mattpolzin / Makefile
Created October 27, 2021 17:29
NCurses workaround (makefile snippet)
NCURSES_VERSION ?= 6
ncurses-idris-dep:
mkdir -p deps && \
cd deps && \
git clone https://github.com/mattpolzin/ncurses-idris.git && \
cd ncurses-idris && \
cat NCurses.idr | sed 's/libncurses"/libncurses $(NCURSES_VERSION)"/' > tmp.idr && \
rm NCurses.idr && mv tmp.idr NCurses.idr && \
make && make install && \
@mattpolzin
mattpolzin / incomplete_dom_ex.html
Created October 1, 2021 20:54
Incomplete example of DOM generation and interaction
<html>
<head>
<meta charset='utf-8'>
<link rel="stylesheet" type="text/css" href="web.css" media="screen"/>
</head>
<body>
<script type='text/javascript' src='build/exec/web.js'></script>
</body>
</html>
@mattpolzin
mattpolzin / gist:b8cf851cb2d61321909ce7d54d3f0a1e
Last active March 21, 2021 21:21
web hooks encode test tweaks
func test_webhooks_encode() throws {
let op = OpenAPI.Operation(responses: [:])
let document = OpenAPI.Document(
info: .init(title: "API", version: "1.0"),
servers: [],
paths: [:],
webhooks: [
"webhook-test": .init(get: op, put: op, post: op, delete: op, options: op, head: op, patch: op, trace: op)
],
components: .noComponents,
@mattpolzin
mattpolzin / watch_and_learn.sh
Last active February 2, 2021 02:36
Little script for watching an Idris source directory and building changes.
#!/usr/bin/env sh
if [[ "$1" == "" ]]; then
${SHELL:-bash} $(pwd)/watch_and_learn.sh watch
exit 0
fi
function watch() {
clear
echo "waiting..."
@mattpolzin
mattpolzin / jsonapi-client-template.swift
Last active June 30, 2020 05:04
A simple template to follow for client side JSONAPI/ReSwift
import Foundation
import Combine
import JSONAPI
import JSONAPIResourceCache
import JSONAPICombine
import ReSwift
import CombineReSwift
@mattpolzin
mattpolzin / openapi-script-example
Created January 27, 2020 07:59
Example OpenAPI tooling script in Swift
#!/usr/bin/swift sh
import Foundation
import ConsoleKit // vapor/console-kit ~> 4.0.0-beta.2.1
import TransformEncoder // @mattpolzin ~> 0.2.0
import OpenAPIKit // @mattpolzin ~> 0.16.0
import Yams // @jpsim ~> 2.0.0
// MARK: - Helpers
extension OpenAPI.HttpVerb: LosslessStringConvertible, CustomStringConvertible {