Skip to content

Instantly share code, notes, and snippets.

View Wooder's full-sized avatar

Jochen Holzer Wooder

  • Karlsruhe, Germany
View GitHub Profile
import Foundation
/// NSURLSession synchronous behavior
/// Particularly for playground sessions that need to run sequentially
public extension NSURLSession {
/// Return data from synchronous URL request
public static func requestSynchronousData(request: NSURLRequest) -> NSData? {
var data: NSData? = nil
let semaphore: dispatch_semaphore_t = dispatch_semaphore_create(0)
@lee-dohm
lee-dohm / gist:3439284
Created August 23, 2012 17:40
Detect the debugger using Objective-C on iOS or OS X
#include <assert.h>
#include <stdbool.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/sysctl.h>
static bool AmIBeingDebugged(void)
// Returns true if the current process is being debugged (either
// running under the debugger or has a debugger attached post facto).
{
@simonseyer
simonseyer / WeakSet.swift
Created February 27, 2018 15:37
Typesafe implementation of a weak set in Swift 4
import Foundation
public class WeakSet<T: AnyObject>: Sequence, ExpressibleByArrayLiteral, CustomStringConvertible, CustomDebugStringConvertible {
private var objects = NSHashTable<T>.weakObjects()
public init(_ objects: [T]) {
for object in objects {
insert(object)
}
@codelynx
codelynx / ZWeakObjectSet.swift
Last active October 26, 2020 01:54
A Swift class that manages weak objects
// WeakObjectSet.swift
//
// The MIT License (MIT)
//
// Copyright (c) 2020 Electricwoods LLC, Kaz Yoshikawa.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@stevemoser
stevemoser / IncompatibleAppsList.plist
Created June 20, 2019 19:38
List of 235 apps incompatible with macOS Catalina 10.15
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IncompatiblePaths</key>
<array>
<dict>
<key>Application Name</key>
<string>Sxs Memory Card Driver</string>
<key>Blurb</key>
@Pacek
Pacek / bundler-fix.md
Last active May 4, 2021 14:55
How to fix Ruby Bundler on Big Sur beta

THE PROBLEM

After updating to macOS Big Sur beta you might encounter issues when using Ruby Bundler to manage Ruby gems in your project - in our case to install CocoaPods and Fastlane for iOS development.

Ignoring json-2.2.0 because its extensions are not built. Try: gem pristine json --version 2.2.0

...

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

@YogevSitton-zz
YogevSitton-zz / AutoDescribingObjects.swift
Last active March 9, 2022 10:05
Use auto-describing objects with CustomStringConvertible
extension CustomStringConvertible {
var description : String {
var description: String = ""
if self is AnyObject {
description = "***** \(self.dynamicType) - <\(unsafeAddressOf((self as! AnyObject)))>***** \n"
} else {
description = "***** \(self.dynamicType) *****\n"
}
let selfMirror = Mirror(reflecting: self)
for child in selfMirror.children {
@chrissimpkins
chrissimpkins / gist:5bf5686bae86b8129bee
Last active March 6, 2023 00:10
Atom Editor Cheat Sheet: macOS

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@preble
preble / WeakSet.swift
Last active July 13, 2023 06:45
A pure Swift weak set.
//
// Created by Adam Preble on 2/19/15.
//
/// Weak, unordered collection of objects.
public struct WeakSet<T where T: AnyObject, T: Hashable> {
typealias Element = T
/// Maps Element hashValues to arrays of Entry objects.
/// Invalid Entry instances are culled as a side effect of add() and remove()
@jessesquires
jessesquires / gitsl.sh
Last active December 3, 2023 07:08
git "smartlog" / "pretty log"
# blog post
#
# https://www.jessesquires.com/blog/customizing-git-log/
git log --graph --pretty=format:'commit: %C(bold red)%h%Creset %C(red)<%H>%Creset %C(bold magenta)%d %Creset%ndate: %C(bold yellow)%cd %Creset%C(yellow)%cr%Creset%nauthor: %C(bold blue)%an%Creset %C(blue)<%ae>%Creset%n%C(cyan)%s%n%Creset'