This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import os | |
from pmtiles.reader import MmapSource, Reader, all_tiles | |
from pmtiles.writer import Writer | |
from pmtiles.tile import Compression | |
from pmtiles.tile import zxy_to_tileid | |
from tqdm import tqdm | |
def merge_pmtiles(input_dir: str, output_file: str) -> None: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AsyncOperation.swift | |
// TopoLock | |
// | |
// Created by VonCannon Tech, Inc. on 8/13/23. | |
// | |
import Foundation | |
//Originally taken fromm: https://gist.github.com/Sorix/57bc3295dc001434fe08acbb053ed2bc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIView *PSPDFFindFirstResponderBeneathView(UIView *view) { | |
// Stop if e.g. we show an UIAlertView with a text field. | |
if (UIApplication.sharedApplication.keyWindow != view.window) return nil; | |
// Search recursively for first responder. | |
for (UIView *childView in view.subviews) { | |
if ([childView respondsToSelector:@selector(isFirstResponder)] && childView.isFirstResponder) return childView; | |
UIView *result = PSPDFFindFirstResponderBeneathView(childView); | |
if (result) return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from http://PSPDFKit.com. This snippet is under public domain. | |
#define UIKitVersionNumber_iOS_7_0 0xB57 | |
BOOL PSPDFIsUIKitFlatMode(void) { | |
static BOOL isUIKitFlatMode = NO; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
// We get the modern UIKit if system is running >= iOS 7 and we were linked with >= SDK 7. | |
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) { | |
isUIKitFlatMode = (NSVersionOfLinkTimeLibrary("UIKit") >> 16) >= UIKitVersionNumber_iOS_7_0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSString+Levenshtein.h | |
// PyHelp | |
// | |
// Modified by Michael Bianco on 12/2/11. | |
// <http://mabblog.com> | |
// | |
// Created by Rick Bourner on Sat Aug 09 2003. | |
// rick@bourner.com |