Skip to content

Instantly share code, notes, and snippets.

View jfricker's full-sized avatar

John Fricker jfricker

View GitHub Profile
@IanKeen
IanKeen / Published+Codable.swift
Last active October 8, 2020 16:46
Hack Codable support on to @published (don't use this 😅)
extension Published: Decodable where Value: Decodable {
public init(from decoder: Decoder) throws {
try self.init(initialValue: Value(from: decoder))
}
}
extension Published: Encodable where Value: Encodable {
public func encode(to encoder: Encoder) throws {
let mirror = Mirror(reflecting: self)
// The internal structure uses a `Storage` enum
@stuartcarnie
stuartcarnie / main.m
Created March 4, 2011 19:59
Demonstrates we can now support limited JIT compilation on recent versions of iOS (assuming Apple approves entitlements at some future point)
//
// main.m
// ProtectTest
// Demonstrates newer versions of iOS now support PROT_EXEC pages, for just-in-time compilation.
//
// Must be compiled with Thumb disabled
//
// Created by Stuart Carnie on 3/4/11.
// Copyright 2011 Manomio LLC. All rights reserved.
//
@landonf
landonf / bw-test.sh
Created July 10, 2010 17:53
Simple example of using ipfw to simulate poor network conditions. Handy for mobile performance testing.
# Packet loss rate (percentage, 0.0-1.0)
PLR=0.25
# Delay in ms
DELAY=300
# Host to filter
HOST=example.com
ipfw pipe 1 config bw 800Kbit plr "$PLR" delay "$DELAY"