Skip to content

Instantly share code, notes, and snippets.

@raven
raven / fetch-xcode.sh
Created September 23, 2022 12:24
Download Xcode without Apple ID
# Fetch ADCDownloadAuth cookie
curl --cookie-jar cookie_file 'https://developerservices2.apple.com/services/download?path=%2FDeveloper_Tools%2FXcode_14%2FXcode_14.xip'
# Download Xcode using fetched ADCDownloadAuth cookie
curl --cookie cookie_file --remote-name 'https://download.developer.apple.com/Developer_Tools/Xcode_14/Xcode_14.xip'
@raven
raven / git-by-date
Last active April 11, 2019 01:47 — forked from kennyp/git-by-date
If you need to sort files by creation date in git.ex. `find . -name '*ViewModel*' | git-by-date`
#!/bin/bash
while read f
do
echo "$(git log --format="%ai" --reverse "$f" | head -n1) $f"
done | sort -n
@raven
raven / FunTimesWithUITextField.swift
Created May 2, 2018 14:09
Applying `typingAttributes` whilst firstResponder on a UITextField
textField.text = "fred"
textField.becomeFirstResponder()
DispatchQueue.main.async {
// Set some typingAttributes
self.textField.typingAttributes = [NSAttributedStringKey.font.rawValue: UIFont.boldSystemFont(ofSize: 18)]
// Resign first responder
self.textField.resignFirstResponder()
DispatchQueue.main.async {
@raven
raven / SafariUITests.swift
Created November 28, 2017 11:46
Launching Mobile Safari for iOS UITests with a specific URL
// Get a hold of Mobile Safari
let safari = XCUIApplication(bundleIdentifier: "com.apple.mobilesafari")
// Pass in the launch arguments to open specific url immediately
safari.launchArguments = ["-u", "http://google.com"]
safari.launch()
// If using deeplinks, you will need to accept the prompt
safari.buttons.matching(identifier: "Open").firstMatch.tap()
@raven
raven / ViewController.swift
Created October 23, 2017 20:00
PKPaymentAuthorizationResult errors that are of Swift.Error type will crash the host application Radar: 35131271
//
// Copyright © 2017 Peter Goldsmith. All rights reserved.
//
import UIKit
import PassKit
struct BananaError: Error {}
class ViewController: UIViewController {
@raven
raven / ViewController.swift
Last active May 11, 2017 20:12
rdar://30739102
//
// ViewController.swift
// AttributedString
//
// Created by Peter Goldsmith on 27/02/2017.
//
import UIKit
class ViewController: UIViewController {
@raven
raven / Breakpoints_v2.xcbkptlist
Last active August 30, 2019 00:53
Symbolic breakpoint for dynamically linking libReveal against UIApplicationMain
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.SymbolicBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
@raven
raven / about.md
Created August 10, 2011 00:58 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer