Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct
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 CloudKit | |
import Foundation | |
import Locksmith | |
/** | |
API Key used by this app is fetched from CloudKit. This class manages fetching and saving it into Keychain | |
*/ | |
class ApiKey { | |
private static let RECORD_NAME = <# RECORD_NAME_IN_CLOUDKIT #> | |
private static let KEY = <# KEY_NAME_IN_CLOUDKIT #> |
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
// | |
// FrameCaptureModifier.swift | |
// FrameCaptureModifier | |
// | |
// Created by Marc Palmer on 31/03/2020. | |
// | |
// This is free and unencumbered software released into the public domain. | |
// | |
// Anyone is free to copy, modify, publish, use, compile, sell, or | |
// distribute this software, either in source code form or as a compiled |
Newsweek January 21, 1980
Isaac Asimov/My Turn
It's hard to quarrel with that ancient justification of the free press: "America's right to know." It seems almost cruel to ask, ingenously, "America's right to know what, please? Science? Mathematics? Economics? Foreign languages?"
None of those things, of course.
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 SwiftSyntax | |
import SwiftSemantics | |
import Foundation | |
let source = try! String(contentsOf: URL(fileURLWithPath: "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/SwiftUI.framework/Modules/SwiftUI.swiftmodule/arm64e.swiftinterface")) | |
var collector = DeclarationCollector() | |
let tree = try SyntaxParser.parse(source: source) | |
tree.walk(&collector) |
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
// Copyright (c) 2019–20 Adam Sharp and thoughtbot, inc. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
// | |
// DraggableView.swift | |
// Created by Jason Jobe on 9/15/21. | |
// | |
import SwiftUI | |
public struct DraggableView: ViewModifier { | |
public enum Axis { case x, y, xy } |
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 Foundation | |
// A bunch of convenience things | |
func const <A, B> (b: B) -> A -> B { | |
return { _ in b } | |
} | |
func repeat <A> (n: Int) -> A -> [A] { | |
return { a in | |
return map(Array(1...n), const(a)) | |
} |
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
// | |
// SnapCarousel.swift | |
// prototype5 | |
// | |
// Created by xtabbas on 5/7/20. | |
// Copyright © 2020 xtadevs. All rights reserved. | |
// | |
import SwiftUI |
NewerOlder