Skip to content

Instantly share code, notes, and snippets.

View voncannon's full-sized avatar
💪
If you ain't breakin, you ain't buildin

Bryan VonCannon voncannon

💪
If you ain't breakin, you ain't buildin
View GitHub Profile
NSString *const PSPDFApplicationDidReceiveMemoryWarningNotification = @"PSPDFApplicationDidReceiveMemoryWarningNotification";
// Test with sudo memory_pressure -l critical. Don't forget to re-set afterwards!
__attribute__((constructor)) static void PSPDFInstallLowMemoryNotificationWarningMac(void) {
static dispatch_source_t source;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, 0, DISPATCH_MEMORYPRESSURE_WARN|DISPATCH_MEMORYPRESSURE_CRITICAL, dispatch_get_main_queue());
dispatch_source_set_event_handler(source, ^{
dispatch_source_memorypressure_flags_t pressureLevel = dispatch_source_get_data(source);
@voncannon
voncannon / inject-xcodebuild-settings.sh
Last active August 29, 2015 14:15
Passing Xcode Environment Variables to Jenkins
# Original Source: http://www.tuicool.com/articles/jMF773
# Another Source: https://groups.google.com/forum/#!topic/cocoaheadsau/FE5rr30ydBY
xcodebuild -showBuildSettings | \
sed -e '1d;s/^[ ]*/export /;s/ = \([^"].*\)/="\1"/;s/ = /=/;s/export UID.*//' > /tmp/xcodebuild-var.tmp
source /tmp/xcodebuild-var.tmp
rm /tmp/xcodebuild-var.tmp
# Example Usage
@voncannon
voncannon / AsyncOperation.swift
Last active March 14, 2024 19:36
Swift Async Operation
//
// AsyncOperation.swift
// TopoLock
//
// Created by VonCannon Tech, Inc. on 8/13/23.
//
import Foundation
//Originally taken fromm: https://gist.github.com/Sorix/57bc3295dc001434fe08acbb053ed2bc
@voncannon
voncannon / NSManagedObjectContext+Extensions.swift
Last active May 10, 2024 15:10
Core Data Save Extensions - Save if app is backgrounded
//
// NSManagedObjectContext+Extensions.swift
// Topo Lock Maps
//
// Created by VonCannon Technology, Inc. on 12/8/23.
//
import Foundation
import UIKit
import CoreData
@voncannon
voncannon / MainMapLibreViewRepresentation.swift
Created May 10, 2024 16:21
MapLibre Swift UI View Representation
//
// MainMapLibreViewRepresentation.swift
// Topo Lock Maps
//
// Created by VonCannon Technology, Inc. on 6/20/23.
//
import SwiftUI
import Foundation
import Mapbox
@voncannon
voncannon / MapLibreCoordinator.swift
Created May 10, 2024 16:24
MapLibre SwiftUI Coordinator
//
// MapLibreCoordinator.swift
// Topo Lock Maps
//
// Created by VonCannon Technology, Inc. on 9/19/23.
//
import Foundation
import SwiftUI
import Mapbox