Skip to content

Instantly share code, notes, and snippets.

View Fastfile-2-example
# Customise this file, documentation can be found here:
# All available actions:
# can also be listed using the `fastlane actions` command
# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`
# If you want to automatically update fastlane if a new version is available:
# update_fastlane
johnkodes / RelativeSizeLayout.swift
Created March 25, 2023 11:45 — forked from ole/RelativeSizeLayout.swift
A SwiftUI layout and modifier for working with relative sizes ("50 % of your container").
View RelativeSizeLayout.swift
import SwiftUI
extension View {
/// Proposes a percentage of its received proposed size to `self`.
/// This modifier multiplies the proposed size it receives from its parent
/// with the given factors for width and height.
/// If the parent proposes `nil` or `.infinity` to us in any dimension,
/// we’ll forward these values to our child view unchanged.
johnkodes / Sequence+unique.swift
Created March 7, 2023 13:25
Unique elements from Sequence
View Sequence+unique.swift
extension Sequence {
/// Returns an array containing, in order, the first instances of
/// elements of the sequence that compare equally for the keyPath.
func unique<T: Hashable>(for keyPath: KeyPath<Element, T>) -> [Element] {
var unique = Set<T>()
return filter { unique.insert($0[keyPath: keyPath]).inserted }
extension RangeReplaceableCollection {
johnkodes / Remove whitespace
Created March 2, 2023 13:39
Remove whitespace from folder
View Remove whitespace
find . -not \( -name .git -prune \) -type f -print0 | LANG=C LC_CTYPE=C xargs -0 sed -i '' -E "s/[[:space:]]*$//"