Skip to content

Instantly share code, notes, and snippets.

View vincent-peng's full-sized avatar

Vincent Peng vincent-peng

  • Sydney, Australia
View GitHub Profile
@vincent-peng
vincent-peng / Data+HexEncodedString.swift
Last active November 26, 2023 14:28
Convert Data to hex string in Swift
// http://stackoverflow.com/a/40089462
extension Data {
func hexEncodedString() -> String {
return map { String(format: "%02hhx", $0) }.joined()
}
}
@vincent-peng
vincent-peng / csv2json.php
Created December 16, 2015 00:04
Convert .csv file to JSON
#!/usr/bin/php
<?php
/*
Usage: csv2json.php <path to .csv file>
*/
$SCRIPT_PARENT_DIR = dirname($argv[0]);