0. Download the Model 01 firmware:
$ git clone https://github.com/keyboardio/Model01-Firmware.git
$ cd Model01-Firmware
import PlaygroundSupport | |
import UIKit | |
final class LabelViewController: UIViewController { | |
var label: UILabel! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
view.backgroundColor = .systemBackground |
def integratel(f,a,b,n): | |
y = 0 | |
for i in range(0,n): | |
y = y + f(a + (b-a)*i/n) | |
return y*(b-a)/n | |
def acceleration_time_fn(k,a,b,c,m): | |
return lambda x : max(x/(k - a*x - b*x**2 - c*x**3), 1/m) | |
def deceleration_time_fn(k,a,b,c,m): |
$ git clone https://github.com/keyboardio/Model01-Firmware.git
$ cd Model01-Firmware
arduino-cli
:import Foundation | |
import QuartzCore | |
extension NSCoder { | |
public func decodeIfPresent<T>(_ valueType: T.Type, forKey key: CodingKey) -> T? { | |
guard self.containsValue(forKey: key.stringValue) else { return nil } | |
return self.decodeObject(forKey: key.stringValue) as? T | |
} | |
public func decodeCGRectIfPresent(forKey key: CodingKey) -> CGRect? { |
# remove Xcode build cache | |
function xcode-unfuck-deriveddata() { | |
XCODE_DERIVED_DATA_DIR=`defaults read com.apple.dt.xcode.IDECustomDerivedDataLocation 2>&1 >/dev/null` | |
if [[ -e $XCODE_DERIVED_DIR ]]; then; | |
XCODE_DERIVED_DATA_DIR=~/Library/Developer/Xcode/DerivedData | |
fi | |
rm -rf $XCODE_DERIVED_DATA_DIR | |
} | |
const sampleInputs = [ | |
"OAuth Token", | |
"Hello-World!", | |
]; | |
String.prototype.capitalized = function() { | |
const firstCharacter = this.charAt(0).toUpperCase(); | |
const remainder = this.substring(1); | |
return firstCharacter + remainder; | |
}; |
import Foundation | |
let sampleInputs = [ | |
"OAuth Token", | |
"Hello-World!", | |
] | |
extension String { | |
func capitalized() -> String { | |
guard let firstCharacter = self.characters.first else { return "" } |
import Foundation | |
/// https://developer.apple.com/documentation/swift/range | |
enum NamedService: String { | |
case altamontCorridor | |
case californiaZephyr | |
case caltrain | |
case capitolCorridor | |
case coaster |
I hereby claim:
To claim this, I am signing this object:
import Foundation | |
public protocol DataDecoder { | |
func decode<T>(_ type: T.Type, from data: Data) throws -> T where T : Decodable | |
} | |
extension JSONDecoder: DataDecoder {} | |
extension PropertyListDecoder: DataDecoder {} | |
extension URLSession { |