Skip to content

Instantly share code, notes, and snippets.

@kristopherjohnson
kristopherjohnson / DispatchGroupDemo.swift
Last active May 28, 2021 14:40
Simple demo of dispatch_group_async/dispatch_group_notify/dispatch_group_wait in Swift
import Foundation
let notified = dispatch_semaphore_create(0)
let group = dispatch_group_create()
let queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
for n in 0..<20 {
dispatch_group_async(group, queue) {
let timeInterval = Double(arc4random_uniform(1000)) * 0.01
@zorgiepoo
zorgiepoo / gist:d751cba19a0167a589a2
Last active October 21, 2023 07:54
Example program for retrieving active URLs from Safari webkit processes.
#import <Foundation/Foundation.h>
// Useful references:
// -[SMProcess webKitActiveURLs] implementation used in Activity Monitor on 10.9 (search for it using Hopper)
// http://opensource.apple.com/source/WebKit2/WebKit2-7537.71/WebProcess/mac/WebProcessMac.mm
// https://github.com/rodionovd/RDProcess/blob/master/RDProcess.m
const CFStringRef kLSActivePageUserVisibleOriginsKey = CFSTR("LSActivePageUserVisibleOriginsKey");
const int kLSMagicConstant = -1;
@yamaya
yamaya / xcode-clang-vers
Last active October 29, 2024 05:10
Xcode clang version record
# Xcode 4.3.3
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
# Xcode 4.3.2
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix