Skip to content

Instantly share code, notes, and snippets.

View krzyzanowskim's full-sized avatar

Marcin Krzyzanowski krzyzanowskim

View GitHub Profile
@Ashton-W
Ashton-W / Breakpoints_v2.xcbkptlist
Last active January 25, 2023 09:28
My User Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<!-- All Exceptions -->
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
@steipete
steipete / gist:99f8aa8d6527fa027fd6
Last active August 29, 2015 14:25
Mirror for https://forums.developer.apple.com/thread/11098 since that needs moderation first (submitted Jul 16 2015)
We're working on supporting Bitcode in PSPDFKit but hit a blocking issue with OpenSSL (latest 1.0.2d).
We're using a script that downloads and builds OpenSSL into fat static libraries for both Mac and iOS. I've put the gist here:
https://gist.github.com/steipete/ce09ba176a4b8ef66b2d/bf053eab1c0f8494dcd3748079543c4ed4367b9c
Enabling Bitcode should be as easy as adding `-fembed-bitcode` as clang flag according to this entry. That's exactly what I did.
Now things build, but the script eventually stops with this error:
ld: could not open bitcode temp file: ../libcrypto.a(aes-x86_64.o) for architecture x86_64
import Cocoa
enum CoroutineState {
case Fresh, Running, Blocked, Canceled, Done
}
struct CoroutineCancellation: ErrorType {}
class CoroutineImpl<InputType, YieldType> {
let body: (yield: YieldType throws -> InputType) throws -> Void
@rnapier
rnapier / 1-simplejson.swift
Last active February 3, 2018 22:59
Yeah, @krzyzanowskim is probably right. What problem were we solving?
import Foundation
// All the complexity needed to avoid this code probably isn't worth it in the majority of cases.
// Particularly note that the data model doesn't 100% line up with the JSON (some keys have
// slightly different names for instance). A system flexible enough to handle that (say, something
// like Go's json.Marshal) would be nice, but this code, while slightly tedious, isn't really bad.
// Basically I'm saying that a richer JSON<->Swift system built into stdlib would be nice, but the
// bar is pretty high to go pulling in a helper library.
//
// That said, compare the Go code below, and I think it really is much simpler, and scales much better
// Created by Chris Eidhof on 04-01-16.
// Copyright © 2016 Chris Eidhof. All rights reserved.
//
// Large parts copy/pasted from https://github.com/Eonil/TCPIPSocket.Swift
import Foundation
struct TCPIPSocketAddress {
init(_ a:UInt8, _ b:UInt8, _ c:UInt8, _ d:UInt8) {
let a1 = UInt32(a) << 24
@steipete
steipete / ios-xcode-device-support.sh
Last active December 12, 2023 03:36
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@steipete
steipete / Warnings.xcconfig
Last active March 13, 2018 14:47
Did you knew that Clang Analyzer as alpha checkers? Early Christmas is here! (Ignore the rest... we run our PDF SDK https://pspdfkit.com with -Weverything because warnings are awesome to prevent bugs) - See https://gist.github.com/steipete/28849365e603dc2015c7107d85142e7b/revisions for a list of Xcode 8.3 changes
// clang -cc1 -analyzer-checker-help
// OVERVIEW: Clang Static Analyzer Checkers List
// USAGE: -analyzer-checker <CHECKER or PACKAGE,...>
//
// CHECKERS:
// alpha.core.BoolAssignment Warn about assigning non-{0,1} values to Boolean variables
// alpha.core.CallAndMessageUnInitRefArg
// Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers, and pointer to undefined variables)
// alpha.core.CastSize Check when casting a malloc'ed type T, whether the size is a multiple of the size of T
// alpha.core.CastToStruct Check for cast from non-struct pointer to struct pointer
@simme
simme / debounce-throttle.swift
Created December 20, 2016 10:04
Swift 3 debounce & throttle
//
// debounce-throttle.swift
//
// Created by Simon Ljungberg on 19/12/16.
// License: MIT
//
import Foundation
extension TimeInterval {
@myell0w
myell0w / KeyboardLayoutGuide.swift
Created July 19, 2017 14:53
A UILayoutGuide that follows the Keyboard on iOS
import Foundation
import UIKit
/// Used to create a layout guide that pins to the top of the keyboard
final class KeyboardLayoutGuide {
private let notificationCenter: NotificationCenter
private let bottomConstraint: NSLayoutConstraint
@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 7, 2024 09:05
Swift Concurrency Manifesto