Skip to content

Instantly share code, notes, and snippets.

View ppeelen's full-sized avatar
🎯
Focusing, always!

Paul Peelen ppeelen

🎯
Focusing, always!
View GitHub Profile
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active April 19, 2024 16:21
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@telliott99
telliott99 / bytes.swift
Last active October 11, 2023 13:07
convert NSData -> [UInt8]
import Foundation
let n = 256
let a = Array(0..<n).map { UInt8($0) }
let data = NSData(bytes: a, length: a.count)
print(data) // "<0001...feff>"
let stream = NSInputStream(data: data)
stream.open()
@jakebellacera
jakebellacera / how-to-install-php-development-environment-on-osx.md
Last active August 24, 2018 10:53
How to install a basic Apache, PHP and MySQL development environment with Homebrew. Mirrored from the Echo & Co. blog.

How to install a basic Apache, PHP and MySQL development environment with Homebrew

This guide will walk you through the steps required to install a basic Apache, PHP and MySQL development environment using homebrew. Basically, all you'll need to do is copy the commands below into Terminal. Copy one block at a time.

NOTE: this guide is mirrored from Echo & Co.'s blog in case the original blog post or the website decides to go down. I've shared this guide around many times to colleagues and friends. Please give Alan Ivey (@alanthing) all of the credit for publishing this really helpful guide.

Before we begin...

We're going to need to install homebrew, a super awesome package manager for OS X. Installation instructions are available on the homebrew website.

@dduan
dduan / XCTest+Eventually.swift
Last active January 11, 2023 00:26
A simple "eventually" method to aide asynchronous testing with XCTest
import XCTest
extension XCTestCase {
/// Simple helper for asynchronous testing.
/// Usage in XCTestCase method:
/// func testSomething() {
/// doAsyncThings()
/// eventually {
/// /* XCTAssert goes here... */
@westerlund
westerlund / FontSizesHelper.swift
Last active July 17, 2022 18:17
I made a really simple helper for using Dynamic Type with your own fonts
struct FontSizesHelper {
static func dynamicSize(for originalSize: CGFloat, category: UIContentSizeCategory = UIApplication.shared.preferredContentSizeCategory) -> CGFloat {
let modifyBy: CGFloat = {
switch category {
case .extraSmall: return -3
case .small: return -2
case .medium: return -1
case .large: return 0
case .extraLarge: return 2
case .extraExtraLarge: return 4
import UIKit
import PlaygroundSupport
class ArcView: UIView {
private var strokeWidth: CGFloat {
return CGFloat(min(self.bounds.width, self.bounds.height) * 0.25)
}
override open func draw(_ rect: CGRect) {
super.draw(rect)