Skip to content

Instantly share code, notes, and snippets.


Helge Heß helje5

View GitHub Profile
garsdle / View+Relative.swift
Last active Jul 27, 2021 — forked from IanKeen/View+Relative.swift
SwiftUI relative frame
View View+Relative.swift
struct SizePreferenceKey: PreferenceKey {
static var defaultValue: CGSize = .zero
static func reduce(value: inout CGSize, nextValue: () -> CGSize) {
value = nextValue()
struct RelativeSizeModifier: ViewModifier {
let percentWidth: CGFloat
ollieatkinson / SVG.swift
Last active Jan 27, 2022
Utilise the private CoreSVG framework in Swift
View SVG.swift
import Darwin
import Foundation
import UIKit
class CGSVGDocument: NSObject { }
var CGSVGDocumentRetain: (@convention(c) (CGSVGDocument?) -> Unmanaged<CGSVGDocument>?) = load("CGSVGDocumentRetain")
var CGSVGDocumentRelease: (@convention(c) (CGSVGDocument?) -> Void) = load("CGSVGDocumentRelease")
var CGSVGDocumentCreateFromData: (@convention(c) (CFData?, CFDictionary?) -> Unmanaged<CGSVGDocument>?) = load("CGSVGDocumentCreateFromData")

This page is now depreacted!

Check out the repo instead. The Wisdom of Quinn Now with 100% more archived PDFs.

The Wisdom of Quinn

Informative DevForum posts from everyone's favorite DTS member.

(Arranged newest to oldest)

IanKeen / Combined.swift
Last active Aug 24, 2021
Combined: A type composed of other types (potential alternative to my Partial<T> type)
View Combined.swift
struct Combined<A, B> {
private let a: A
private let b: B
init(a: A, b: B) { (self.a, self.b) = (a, b) }
subscript<T>(dynamicMember keyPath: KeyPath<A, T>) -> T {
return a[keyPath: keyPath]
IanKeen / DictionaryEncoder.swift
Last active May 4, 2021
DictionaryEncoder for Encodable types
View DictionaryEncoder.swift
class DictionaryEncoder {
init() { }
func encode(_ value: Encodable) throws -> [String: Any] {
let encoder = _Encoder(codingPath: [])
try value.encode(to: encoder)
guard let result = encoder.value as? [String: Any] else {
throw EncodingError.invalidValue(encoder.value as Any, .init(codingPath: [], debugDescription: "Invalid root container"))
View helloworld.swift
import Foundation
import NIO
import NIOHTTP1
// Inspired/parts copied from
final class HelloHandler: ChannelInboundHandler {
typealias InboundIn = HTTPServerRequestPart
func channelRead(ctx: ChannelHandlerContext, data: NIOAny) {
maelvls /
Last active Nov 5, 2021
Automate build workflow for Homebrew tap bottles (Linux and macOS)

How to automate the build of bottles on your Homebrew tap

Note on Oct 4, 2018: due to a change in Homebrew's brew test-bot behaviour, the user must set HOMEBREW_TRAVIS_CI and HOMEBREW_TRAVIS_SUDO appropriately (it was previously using Travis-CI-provided TRAVIS and TRAVIS_SUDO).

This tutorial is a follow-up to the discussion we had on It relies on a fork of the test-bot provided by davidchall; you can get it with brew tap maelvalais/test-bot. First:

  1. the Github project must be of the form<user>/homebrew-<tap> with the following tree
ericclemmons /
Last active Jan 16, 2022
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

 <summary>Summary Goes Here</summary>

Writing template strings in Markdown

With template strings coming to ES6, the backtick (`) means something in Markdown and in JavaScript. If you write this:

To display a message, write `alert(`hello world!`)`.

it'll render like this:

To display a message, write alert(hello world!).

sazameki / RVNReceiptValidation.m
Created Jul 1, 2012
Mac App Store Receipt Validation Sample (Mac OS X 10.7)
View RVNReceiptValidation.m
// RVNReceiptValidation.m
// Created by Satoshi Numata on 12/06/30.
// Copyright (c) 2012 Sazameki and Satoshi Numata, Ph.D. All rights reserved.
// This sample shows how to write the Mac App Store receipt validation code.
// Replace kRVNBundleID and kRVNBundleVersion with your own ones.
// This sample is provided because the coding sample found in "Validating Mac App Store Receipts"