Skip to content

Instantly share code, notes, and snippets.

@mattpolzin
mattpolzin / bitrise_swift_codecov.sh
Last active October 13, 2019 20:59
A bitrise bash script to take codecov from a previous `swift test --enable-code-coverage` step and generate some basic human readable stats.
#!/usr/bin/env bash
# fail if any commands fails
set -e
##
## INPUTS
## - $CODECOV_JSON - The location of the JSON file produced by
## swift test --enable-code-coverage
@mattpolzin
mattpolzin / docker_monitor
Last active November 21, 2019 17:22
Monitor a Docker Stack from Mac OS
#!/usr/bin/swift sh
// https://github.com/vapor/console-kit
import ConsoleKit // vapor/console-kit ~> 4.0.0-beta.1
import Foundation
// MARK: - Shell
let shellSuccessCode: Int32 = 0
struct ShellOut {
@mattpolzin
mattpolzin / docker-compose.dev.yml
Last active January 16, 2020 01:30
A template docker-compose file for Vapor apps
version: "3.7"
x-common: &common
environment:
SHARED_ENV_VAR1: 'value'
SHARED_ENV_VAR2: 'value'
services:
vapor_app: # name this whatever you want
<<: *common
@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 {
@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 / 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 / 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 / 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 / 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 / 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.