Skip to content

Instantly share code, notes, and snippets.

View practicalswift's full-sized avatar

practicalswift (Thomas J) practicalswift

View GitHub Profile
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links

Simple Security Guidelines

Using an iDevice? (Best option)

  • Use an iPod or an iPad without a SIM card
  • Use an iPhone
  • Do not jailbreak
  • Always upgrade to new iOS versions
  • Use Brave browser

Need Secure chat?

@kristopherjohnson
kristopherjohnson / unzip.swift
Last active December 10, 2022 14:21
zip(), zip3(), unzip(), and unzip3() for Swift
// Given array of 2-tuples, return two arrays
func unzip<T, U>(array: [(T, U)]) -> ([T], [U]) {
var t = Array<T>()
var u = Array<U>()
for (a, b) in array {
t.append(a)
u.append(b)
}
return (t, u)
}
// See: https://devforums.apple.com/message/1000934#1000934
import Foundation
// Logic
operator prefix ¬ {}
@prefix func ¬ (value: Bool) -> Bool {
return !value
}
@jpsim
jpsim / JAZMusician.h
Created July 7, 2014 09:25
SourceKit Playground
//
// JAZMusician.h
// JazzyApp
//
#import <Foundation/Foundation.h>
/**
JAZMusician models, you guessed it... Jazz Musicians!
From Ellington to Marsalis, this class has you covered.
@schani
schani / SwiftSet.swift
Last active August 13, 2018 05:07 — forked from algal/SwiftSet.swift
struct MySet<KeyType : Hashable> : Sequence, ArrayLiteralConvertible
{
var dictionaryOfItems = Dictionary<KeyType,Bool>()
typealias GeneratorType = MapSequenceGenerator<Dictionary<KeyType, Bool>.GeneratorType, KeyType>
init() {}
init(array: KeyType[]) {
for item in array {
self.dictionaryOfItems.updateValue(true, forKey: item)
}
anonymous
anonymous / Set.swift
Created June 10, 2014 17:43
import Swift
struct SetGenerator<T : Hashable> : Generator {
var dictGenerator : DictionaryGenerator<T, Void>
init(_ d : Dictionary<T,Void>) {
dictGenerator = d.generate()
}
//
// Set
//
struct MySet<KeyType : Hashable> : Sequence
{
var dictionaryOfItems = Dictionary<KeyType,Bool>()
init() {}
init(array:Array<KeyType>) {
@calebd
calebd / ArrayHelpers.swift
Last active November 4, 2022 15:17
Swift Helpers
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {