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
// Smart little helper to find main thread hangs. Enable in appDidFinishLaunching. | |
// Only available with source code in DEBUG mode. | |
@interface PSPDFHangDetector : NSObject | |
+ (void)startHangDetector; | |
@end | |
@implementation PSPDFHangDetector | |
+ (void)startHangDetector { | |
#ifdef DEBUG |
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
ACTION | |
AD_HOC_CODE_SIGNING_ALLOWED | |
ALTERNATE_GROUP | |
ALTERNATE_MODE | |
ALTERNATE_OWNER | |
ALWAYS_SEARCH_USER_PATHS | |
ALWAYS_USE_SEPARATE_HEADERMAPS | |
APPLE_INTERNAL_DEVELOPER_DIR | |
APPLE_INTERNAL_DIR | |
APPLE_INTERNAL_DOCUMENTATION_DIR |
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
- Open Automator | |
- File -> New -> Service | |
- Change "Service Receives" to "files or folders" in "Finder" | |
- Add a "Run Shell Script" action | |
- Change "Pass input" to "as arguments" | |
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*" | |
- Save it as something like "Open in Visual Studio Code" |
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
package ... | |
private val identityMap: (String) -> String = { it } | |
sealed class LocalizedString | |
data class ResourceString( | |
val id: Int, | |
val quantity: Int? = null, | |
val args: List<Any> = emptyList(), |
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
import io.ktor.client.request.HttpRequest | |
import io.ktor.content.TextContent | |
import java.util.* | |
class CurlBuilder( | |
request: HttpRequest, | |
private val ignoreHeaders: List<String> = emptyList() | |
) { | |
private val url: String = request.url.toString() | |
private val method: String = request.method.value |
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
package datasizeformatter | |
import kotlin.math.abs | |
import kotlin.math.pow | |
import kotlin.math.roundToLong | |
/** | |
* Format a human-readable representation of data size, in binary base form. | |
* e.g. 1024 -> 1 KiB | |
* @param byteCount The number of bytes to represent in human-readable form. `Long.MIN_VALUE` is unsupported. |
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
class Test { | |
val names: List<String> | |
field: MutableList<String> = mutableListOf<String>() | |
fun doThing() { | |
names.add("Hello!") | |
} | |
} | |
fun main() { |
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
// ADD THIS CODE | |
struct Binder { | |
private static func binding<T, R>( | |
mutable: CMutableStateFlow<T>, | |
viewModel: ViewModel, | |
equals: @escaping (T?, T?) -> Bool, | |
getMapper: @escaping (T) -> R, | |
setMapper: @escaping (R) -> T | |
) -> Binding<R> { |