This file contains hidden or 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
func load<T: Decodable>(_ filename: String) -> T { | |
let data: Data | |
guard let file = Bundle.main.url(forResource: filename, withExtension: nil) | |
else { | |
fatalError("Couldn't find \(filename) in main bundle.") | |
} | |
do { | |
data = try Data(contentsOf: file) |
This file contains hidden or 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
// http://stackoverflow.com/a/40089462 | |
extension Data { | |
func hexEncodedString() -> String { | |
return map { String(format: "%02hhx", $0) }.joined() | |
} | |
} |
This file contains hidden or 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
#!/usr/bin/php | |
<?php | |
/* | |
Usage: csv2json.php <path to .csv file> | |
*/ | |
$SCRIPT_PARENT_DIR = dirname($argv[0]); |