Skip to content

Instantly share code, notes, and snippets.

View hyperspacemark's full-sized avatar

Mark Adams hyperspacemark

View GitHub Profile
private func loadCFunction<Function>(named name: String, ofType _: Function.Type = Function.self) -> Function {
let sym = dlsym(UnsafeMutablePointer<Void>(bitPattern: -2), name) // RTLD_DEFAULT
return unsafeBitCast(sym, Function.self)
}
private let CC_SHA1_DIGEST_LENGTH = 20
private let CC_SHA1: @convention(c) (UnsafePointer<Void>, Int32, UnsafeMutablePointer<UInt8>) -> UnsafeMutablePointer<UInt8> = loadCFunction(named: "CC_SHA1")
extension String {
@hyperspacemark
hyperspacemark / 0_reuse_code.js
Created January 30, 2014 00:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console