This file contains hidden or 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 Foundation | |
class ThreadQueue { | |
private var mutex = pthread_mutex_t() | |
private var cond = pthread_cond_t() | |
// these are shared variables and should only be modified within a `lock` block | |
private var threadId: pthread_t? = nil | |
private var isStopped = true | |
private var queue: [() -> Void] = [] |
This file contains hidden or 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
# https://www.bignerdranch.com/blog/manual-swift-understanding-the-swift-objective-c-build-pipeline/ | |
# create build folder | |
mkdir -p build | |
# create Swift->ObjC header and .o file | |
xcrun -sdk macosx10.15 swift \ | |
-frontend -c -primary-file SwiftFile.swift \ | |
-module-name SwiftModule \ | |
-emit-module-path build/SwiftModule.swiftmodule \ |
This file contains hidden or 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 AppKit | |
struct Icon {} | |
struct Canvas {} | |
protocol ToolController { | |
var icon: Icon { get } | |
var name: String { get } | |
func apply(/*...*/) |
This file contains hidden or 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 Foundation | |
protocol ValueProvider { | |
associatedtype Value | |
static var value: Value { get } | |
} | |
@propertyWrapper | |
struct Default<Provider: ValueProvider>: Codable, Hashable where Provider.Value: Codable & Hashable { | |
typealias Value = Provider.Value |
This file contains hidden or 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
// This simple case works fine | |
protocol BasicValueProvider { | |
associatedtype Value | |
static var value: Value { get } | |
} | |
struct False_Basic: BasicValueProvider { | |
static var value: Bool { false } | |
} |
This file contains hidden or 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
$ cloc --exclude-ext=json --exclude-dir=Pods,node_modules,3rd\ Party . | |
6695 text files. | |
5975 unique files. | |
5297 files ignored. | |
github.com/AlDanial/cloc v 1.84 T=3.96 s (354.3 files/s, 59697.4 lines/s) | |
-------------------------------------------------------------------------------- | |
Language files blank comment code | |
-------------------------------------------------------------------------------- | |
Swift 608 22679 10023 75483 |
This file contains hidden or 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
#include <vector> | |
#include <unordered_map> | |
#include <memory> | |
#include <stdio.h> | |
typedef enum : int { | |
TableKindSine, TableKindTriangle, TableKindSaw, TableKindSquare, | |
TableKindCount | |
} TableKind; |
This file contains hidden or 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
$HOME/.config/git/attributes: | |
*.json diff=json | |
$HOME/.gitconfig: | |
[diff "json"] | |
textconv = "f() { cat \"${1}\" | jq --sort-keys .; }; f" |
This file contains hidden or 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
#0 0x0000000103dd5c80 in swift_checkMetadataState () | |
#1 0x0000000103da16bc in type metadata completion function for ClosedRange<>.Index () | |
#2 0x0000000103dd8e24 in swift::MetadataCacheEntryBase<(anonymous namespace)::GenericCacheEntry, void const*>::doInitialization(swift::ConcurrencyControl&, swift::MetadataCompletionQueueEntry*, swift::MetadataRequest) () | |
#3 0x0000000103dd0168 in swift_getGenericMetadata () | |
#4 0x0000000103c505f8 in type metadata accessor for Optional () | |
#5 0x0000000101286afc in BaseMappable.init(JSONString:context:) () | |
#6 0x000000010156926c in LoopAudioUser.init(metadata:song:) at /Users/jayson/Developer/Medly/Medly/Loop/LoopAudioUser.swift:71 |