Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
// | |
// ContentView.swift | |
// SwiftUIPlayground | |
// | |
// Created by BJ Homer on 4/26/21. | |
// | |
import SwiftUI |
/// Returns `(source, transform(source.pointee))` and destroys `source.pointee`. | |
/// | |
/// This is a low-level utility for creating mutable projections of values without | |
/// causing needless copy-on-write. | |
/// | |
/// Typical usage: | |
/// | |
/// func f(x: inout X) { // inout means we have exclusive access to `x`. | |
/// var (xAddress, xFrobnication) | |
/// = unsafeMoveMap(destroying: &x) { x.frobnication() } |
;For Arduino UNO | |
[env:uno] | |
platform = atmelavr | |
board = uno | |
framework = arduino | |
upload_protocol = usbtiny | |
upload_flags = -e | |
;For Esp32 | |
[env:esp32doit-devkit-v1] |
import Combine | |
private protocol LockImplementation { | |
mutating func lock() | |
mutating func `try`() -> Bool | |
mutating func unlock() | |
} | |
private struct UnfairLock: LockImplementation { | |
private var unfairLock = os_unfair_lock_s() |
// How to: | |
// 1. Open the Firebase Analytics Dashboard | |
// 2. Scroll to bottom, where you see the "Users by Device model" widget | |
// 3. Click "View device models" in that widget (this opens the "Tech details" Firebase Analytics page) | |
// 4. Above the table shown in the new page, click on the “Device model” drop down menu and select “OS with Version” | |
// 5. Make sure to select “OS with version” and not “OS Version” | |
// 6. On the top right corner of the page, click on the “Share this report” icon (next to the date) | |
// 7. Click “Download file” on the new side bar, then “Download CSV" | |
// 8. Open the file and select the iOS/Android breakdown raw data | |
// 9. Replace the sample data in this script with your data |
// Created by react-native-create-bridge | |
// import RCTBridgeModule | |
#if __has_include(<React/RCTBridgeModule.h>) | |
#import <React/RCTBridgeModule.h> | |
#elif __has_include(“RCTBridgeModule.h”) | |
#import “RCTBridgeModule.h” | |
#else | |
#import “React/RCTBridgeModule.h” // Required when used as a Pod in a Swift project | |
#endif |
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
Author: Chris Lattner