Skip to content

Instantly share code, notes, and snippets.

View beechtom's full-sized avatar

Tom Beech beechtom

View GitHub Profile
@beechtom
beechtom / makefile
Created August 10, 2019 00:34
Makefile example
CC = g++
SRCEXT = cpp
CFLAGS = -c -std=c++11 -Wall
LFLAGS = -Wall
TARGET = eternity
SRCDIR = src
INCDIR = inc
OBJDIR = obj
@beechtom
beechtom / bolt_config_merging.md
Last active January 22, 2020 23:07
Bolt Config merging

plugin_hooks

Method

Shallow merge

Reason

Bolt already shallow merges plugin_hooks in a few locations. [1, 2, 3, 4]

Example

Global config:

Running /docker-entrypoint.d/00-analytics.sh
(/docker-entrypoint.d/00-analytics.sh) Pupperware analytics disabled; skipping metric submission
Running /docker-entrypoint.d/10-wait-for-hosts.sh
wtfc.sh: waiting 30 seconds for dig postgres && host -t A postgres
wtfc.sh: dig postgres && host -t A postgres finished with expected status 0 after 0 seconds
; <<>> DiG 9.11.3-1ubuntu1.14-Ubuntu <<>> postgres
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29494
@beechtom
beechtom / SectionedResults.swift
Last active October 5, 2023 05:21
SectionedResults-01
import SwiftData
struct SectionedResults<SectionIdentifier, Result>: RandomAccessCollection
where SectionIdentifier: Hashable, Result: PersistentModel {
struct Section: RandomAccessCollection, Identifiable {
}
}
@beechtom
beechtom / SectionedResults.swift
Last active October 5, 2023 05:36
SectionedResults-02
import SwiftData
struct SectionedResults<SectionIdentifier, Result>: RandomAccessCollection
where SectionIdentifier: Hashable, Result: PersistentModel {
struct Section: RandomAccessCollection, Identifiable {
typealias ID = SectionIdentifier
var id: ID
@beechtom
beechtom / SectionedResults.swift
Last active October 5, 2023 05:52
SectionedResults-03
import SwiftData
struct SectionedResults<SectionIdentifier, Result>: RandomAccessCollection
where SectionIdentifier: Hashable, Result: PersistentModel {
struct Section: RandomAccessCollection, Identifiable {
typealias Element = Result
typealias ID = SectionIdentifier
typealias Iterator = IndexingIterator<Self>
@beechtom
beechtom / SectionedResults.swift
Last active October 5, 2023 06:23
SectionedResults-04
import SwiftData
struct SectionedResults<SectionIdentifier, Result>: RandomAccessCollection
where SectionIdentifier: Hashable, Result: PersistentModel {
struct Section: RandomAccessCollection, Identifiable {
typealias Element = Result
typealias ID = SectionIdentifier
typealias Index = Int
@beechtom
beechtom / SectionedResults.swift
Last active October 5, 2023 06:26
SectionedResults-05
import SwiftData
struct SectionedResults<SectionIdentifier, Result>: RandomAccessCollection
where SectionIdentifier: Hashable, Result: PersistentModel {
struct Section: RandomAccessCollection, Identifiable {
var id: SectionIdentifier
var elements: [Result]
var startIndex: Int = 0
@beechtom
beechtom / SectionedResults.swift
Last active October 5, 2023 07:44
SectionedResults-06
import SwiftData
struct SectionedResults<SectionIdentifier, Result>: RandomAccessCollection
where SectionIdentifier: Hashable, Result: PersistentModel {
typealias Element = Self.Section
typealias Index = Int
typealias Iterator = IndexingIterator<Self>
var elements: [Element]