Skip to content

Instantly share code, notes, and snippets.

View jayrhynas's full-sized avatar

Jayson Rhynas jayrhynas

View GitHub Profile
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] = []
import UIKit
class NavigationController: UINavigationController, UINavigationControllerDelegate {
static let enableMasking = true
static let transitionSpeed: Float = 0.1
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .clear
@jayrhynas
jayrhynas / link.sh
Last active May 6, 2020 14:51
Swift & ObjC CLI Linking
import AppKit
struct Icon {}
struct Canvas {}
protocol ToolController {
var icon: Icon { get }
var name: String { get }
func apply(/*...*/)
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 simple case works fine
protocol BasicValueProvider {
associatedtype Value
static var value: Value { get }
}
struct False_Basic: BasicValueProvider {
static var value: Bool { false }
}
$ 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
#include <vector>
#include <unordered_map>
#include <memory>
#include <stdio.h>
typedef enum : int {
TableKindSine, TableKindTriangle, TableKindSaw, TableKindSquare,
TableKindCount
} TableKind;
$HOME/.config/git/attributes:
*.json diff=json
$HOME/.gitconfig:
[diff "json"]
textconv = "f() { cat \"${1}\" | jq --sort-keys .; }; f"
#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