Skip to content

Instantly share code, notes, and snippets.

@avi-c
avi-c / gist:9ba7e78b996973dc95c1898b2bfcae9d
Last active May 12, 2021 18:14
Recipe for exporting KML for routes from My Maps to a GPX file
Go to My Maps in google maps
In one of your Maps, add a turn by turn directions step for the route you want
Right click the top level My Maps window that contains the steps
Select "Export as KML"
Check the KML box and save the file
Open downloaded file in BBEdit or other powerful text editor
Copy out only the portion of the file that is the long list of coordinates and place it in it's own file without the rest of the KML.
In BBEdit, use the find regular expression: (.*?),(.*?),0 and the replace regular expression: <wpt lat="\2" lon="\1"/> to transform the KML coordinate representation into the GPX waypoint format needed by Xcode
Prepend the GPX JSON tags in the following 2 lines:
<?xml version="1.0"?>
@douglashill
douglashill / updateSafeAreaForKeyboardFromNotification.swift
Last active June 25, 2023 16:11
Avoid the keyboard by leveraging additionalSafeAreaInsets.
// Avoids the keyboard in a UIKit app by leveraging additionalSafeAreaInsets.
// You can put this in the root view controller so the whole app will avoid the keyboard.
// Only tested on iOS 13.3.
// Made for https://douglashill.co/reading-app/
@objc func updateSafeAreaForKeyboardFromNotification(_ notification: Notification) {
guard let endFrameInScreenCoords = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else {
return
}
// Please consider whether the force unwrap here is safe for your own use case.
@S2Ler
S2Ler / lldb-debugging.md
Created December 23, 2018 08:45 — forked from alanzeino/lldb-debugging.md
LLDB debugging with examples

LLDB Debugging Cheat Sheet

Commands

LLDB Commands

LLDB comes with a great set of commands for powerful debugging.

help

Your starting point for anything. Type help to get a list of all commands, plus any user installed ones. Type 'help for more information on a command. Type help to get help for a specific option in a command too.

@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active April 26, 2024 10:15
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

от Али-Бабы и разбойников, к лье под водой и к вархаммеру

Давайте я сразу скажу - речь пойдет о биткоинах. При этом не буду вас агитировать за или против - это вообще не мое дело. Я просто расскажу вам о своем отношении к этому феномену и мифам вокруг него.

Для начала стоит сказать, что я не рассматриваю биткоин как валюту. Это не средство, которое заменит кредитные карты или ежедневные расчеты - для этого есть lightning network и другие средства децентрализации. Для меня биткоин - это актив, максимально похожий на золото во всех его проявлениях, кроме физического присутствия. Биткоины добывают, причем, чем больше биткоинов люди уже добыли, тем сложнее добывать дальше. Количество биткоинов, которые вообще можно будет добыть и пустить в оборот, фиксировано. Обмен биткоинами происходит “из рук в руки”. Хранить биткоины не трудно, затратно только получить или передать их. Замените “биткоины” на “золото” - каждое из этих заявлений так же будет действительно.

Поведение “золотых с

@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 1, 2024 15:48
Swift Concurrency Manifesto
@nolanw
nolanw / URLRequest+MultipartFormData.swift
Last active October 5, 2023 14:31
Swift multipart/form-data
// Public domain - https://gist.github.com/nolanw/dff7cc5d5570b030d6ba385698348b7c
import Foundation
extension URLRequest {
/**
Configures the URL request for `multipart/form-data`. The request's `httpBody` is set, and a value is set for the HTTP header field `Content-Type`.
- Parameter parameters: The form data to set.
@ddunbar
ddunbar / xcbuild-debugging-tricks.md
Last active April 13, 2024 15:41
Xcode new build system debugging tricks

New Build System Tricks

Command Line

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole  # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]
@steipete
steipete / PSPDF_KEYPATH.m
Created February 17, 2017 08:38
PSPDF_KEYPATH without all the warnings
#define PSPDF_KEYPATH(object, property) (^{ \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wunreachable-code\"") \
_Pragma("clang diagnostic ignored \"-Wimplicit-retain-self\"") \
return ((void)(NO && ((void)object.property, NO)), @#property); \
_Pragma("clang diagnostic pop") \
}())
@ChristianKienle
ChristianKienle / A_Promise.swift
Last active May 18, 2018 09:10
simplest Promise framework possible?
public struct Promise<T> {
typealias Fulfiller = (T) -> (Void)
typealias Rejecter = (Void) -> (Void)
typealias Resolver = (_ fulfill: @escaping Fulfiller, _ reject: @escaping Rejecter) -> (Void)
let resolver: Resolver
init(_ resolver: @escaping Resolver){
self.resolver = resolver
}
func then<U>(_ execute: @escaping ((T) -> U)) -> Promise<U> {
return Promise<U>({(fulfill, reject) in