Skip to content

Instantly share code, notes, and snippets.

View robmaceachern's full-sized avatar

Robert MacEachern robmaceachern

View GitHub Profile
@DougGregor
DougGregor / parallel_map.swift
Created December 24, 2020 01:10
Swift async/await implementation of a parallel map
extension Collection {
func parallelMap<T>(
parallelism requestedParallelism: Int? = nil,
_ transform: @escaping (Element) async throws -> T
) async throws -> [T] {
let defaultParallelism = 2
let parallelism = requestedParallelism ?? defaultParallelism
let n = self.count
if n == 0 {
@ole
ole / !swiftui-reflection-dump.md
Last active January 20, 2024 15:36
A dump of the SwiftUI.framework binary for the iOS simulator (as of Xcode 12.0 beta 2) using the swift-reflection-dump tool.

A dump of the SwiftUI.framework binary for the iOS simulator (as of Xcode 12.0 beta 2) using the swift-reflection-dump tool.

Note: I used a Swift 5.3 compiler build from a few weeks ago that I had laying around. Because of ABI stability, I don't think the swift-reflection-dump version has to match the compiler version that was used to build the binary, but I'm not 100% sure.

------------------------------------------------------------------------------------------------------------------------
Search for 11_0
------------------------------------------------------------------------------------------------------------------------
Accounts/ACAccountType.h:12: ACCOUNTS_EXTERN NSString * const ACAccountTypeIdentifierTwitter NS_DEPRECATED(NA, 10_13, 5_0, 11_0, "Use Twitter SDK instead");
Accounts/ACAccountType.h:13: ACCOUNTS_EXTERN NSString * const ACAccountTypeIdentifierFacebook NS_DEPRECATED(NA, 10_13, 6_0, 11_0, "Use Facebook SDK instead");
Accounts/ACAccountType.h:14: ACCOUNTS_EXTERN NSString * const ACAccountTypeIdentifierSinaWeibo NS_DEPRECATED(NA, 10_13, 6_0, 11_0, "Use Sina Weibo SDK instead");
Accounts/ACAccountType.h:15: ACCOUNTS_EXTERN NSString * const ACAccountTypeIdentifierTencentWeibo NS_DEPRECATED(NA, 10_13, 7_0, 11_0, "Use Tencent Weibo SDK instead");
Accounts/ACAccountType.h:19: ACCOUNTS_EXTERN NSString * const ACFacebookAppIdKey NS_DEPRECATED(NA, 10_13, 6_0, 11_0, "
@keith
keith / link.sh
Last active December 22, 2016 13:35
Build to iOS 10 from Xcode 7.3.1
@dtorres
dtorres / NSURLBackgroundSessionBits.m
Created November 2, 2015 21:18
Storing Info in background requests.
/*
Basically what we are going to do is use and profit from NSURLRequests being conformant to NSCoding,
and a little known API from NSURLProtocol which allows us attach info to requests.
*/
//Step 0: For the purpose of this gist, we'll already have a background session setup and assume a bunch of stuff.
NSURLSession *bgSession = [NSURLSession magicMethodWhichGivesMeTheAlreadySetupSession]; //Geeez, Methods are long in Obj-C.
//IMPORTANT: Request must be mutable in order for this to work. Got an immutable one. Make a copy. Can't? Well, Make it so!.
//Step 1: Setup your basic request.
@CodaFi
CodaFi / alltheflags.md
Last active October 26, 2022 20:09
Every Option and Flag /swift (1.2) Accepts Ever

#Every Single Option Under The Sun

  • optimization level options
  • automatic crashing options
  • debug info options
  • swift internal options
  • swift debug/development internal options
  • linker-specific options
  • mode options
@kristopherjohnson
kristopherjohnson / NSData_hexadecimalString.swift
Last active July 14, 2018 12:44
Convert NSData bytes to hexadecimal string
import Foundation
extension NSData {
/// Return hexadecimal string representation of NSData bytes
@objc(kdj_hexadecimalString)
public var hexadecimalString: NSString {
var bytes = [UInt8](count: length, repeatedValue: 0)
getBytes(&bytes, length: length)
@BennettSmith
BennettSmith / .gitignore
Last active August 18, 2022 12:09
Google Protobuf v2.6.0 Build Script for iOS
protobuf
protobuf-2.6.0
protobuf-2.6.1
protobuf-master
@andrewroycarter
andrewroycarter / Cocoapods Environment.md
Last active August 17, 2023 10:44
Directions on installing chruby, ruby, ruby-build, and bundler.

Setting up a good cocoapods environment

Before you start

Make sure that you have the latest version of Xcode installed from the Mac App Store, and that you have the command line tools installed. To install the command line tools, open Xcode, click Xcode->Preferences->Downloads->Command Line Tools

Install brew if needed.

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google