Skip to content

Instantly share code, notes, and snippets.

Lily Ballard lilyball

View GitHub Profile
View zalgo.nix
self: super:
{
zalgo =
# make sure we aren't overwriting a package from nixpkgs
assert !super?zalgo;
self.stdenv.mkDerivation {
name = "zalgo";
View keybase.md

Keybase proof

I hereby claim:

  • I am lilyball on github.
  • I am lilyball (https://keybase.io/lilyball) on keybase.
  • I have a public key ASBtGqwn5mVxxk8Mx0dzcbre1Tf9FyO9dJeKBkcWTgWvQwo

To claim this, I am signing this object:

View statemachine.swift
class ViewControllerStandIn {
var stateMachine: StateMachine<State>
init(withSomething: Bool) {
if withSomething {
let delegate = FirstDelegate()
self.stateMachine = StateMachine(withInitialState: .A, callback: delegate.didTransitionFrom(from:to:))
} else {
let delegate = SecondDelegate()
self.stateMachine = StateMachine(withInitialState: .B, callback: delegate.didTransitionFrom(from:to:))
View sorted_over.swift
extension Collection {
func sorted<T: Comparable>(over: (Element) -> T) -> [Element] {
var projections: [(T, Index)] = indices.map({ (over(self[$0]), $0) })
projections.sort(by: { $0.0 < $1.0 })
return projections.map({ self[$0.1] })
}
}
View foo.swift
open class NotMine {
private let a : String
private let b : String
private init(a: String) {
self.a = a
self.b = "\(a)_"
}
public convenience init(a: String, b: String) {
View keybase.md

Keybase proof

I hereby claim:

  • I am lilyball on github.
  • I am eridius (https://keybase.io/eridius) on keybase.
  • I have a public key ASAYjwUUiTS4RII-DgilL7qhK7dvuZfBemmFYOCDRiLhTQo

To claim this, I am signing this object:

View foo.swift
import Foundation
protocol Observer {
associatedtype T
}
class ObservableSparseArray<Element> : NSObject {
typealias T = Element?
let elements : [T] = []
View fakeLazy.swift
struct Foo {
var fakeLazy: Int {
mutating get {
if let value = _fakeLazy { return value }
let value = calculateLazyValue()
_fakeLazy = value
return value
}
set {
_fakeLazy = newValue
View threadsanitizer.swift
func update(_ arg: inout String) {
arg = "UPDATED \(arg)"
}
let mainQueue = DispatchQueue.init(label: "mainQueue", qos: .userInitiated, attributes: [], autoreleaseFrequency: .workItem, target: nil)
let workerQueue = DispatchQueue.init(label: "workerQueue", qos: .userInitiated, attributes: [.concurrent], autoreleaseFrequency: .workItem, target: nil)
let systemQueue = DispatchQueue.init(label: "systemQueue", qos: .userInitiated, attributes: [], autoreleaseFrequency: .workItem, target: nil)
print("Sample Started")
View timespec.swift
extension Date {
var asTimespec: timespec {
let delta = timeIntervalSince1970
let seconds = delta.rounded(.down)
let ns = (delta - seconds) * 1_000_000_000
return timespec(tv_sec: Int(seconds), tv_nsec: Int(ns))
}
}
You can’t perform that action at this time.