Skip to content

Instantly share code, notes, and snippets.

View stzn's full-sized avatar

shiz stzn

View GitHub Profile
@airspeedswift
airspeedswift / list.swift
Created March 23, 2024 18:48
A Basic Noncopyable Singly Linked List in Swift
// To run this code on a Mac with Xcode installed:
// Download the latest toolchain from https://www.swift.org/download/#trunk-development-main and install it
// From a command line:
// export TOOLCHAINS=`plutil -extract CFBundleIdentifier raw -o - /Library/Developer/Toolchains/swift-latest.xctoolchain/Info.plist`
// xcrun swiftc -parse-as-library -enable-experimental-feature NoncopyableGenerics -enable-experimental-feature MoveOnlyPartialConsumption -Xfrontend -disable-round-trip-debug-types -enable-experimental-feature BorrowingSwitch linkedlist.swift
struct Box<Wrapped: ~Copyable>: ~Copyable {
private let pointer: UnsafeMutablePointer<Wrapped>
@wojteklu
wojteklu / clean_code.md
Last active May 8, 2024 11:58
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules