Skip to content

Instantly share code, notes, and snippets.

View T-Pham's full-sized avatar
🖖
Hi!

Thanh Pham T-Pham

🖖
Hi!
View GitHub Profile
@T-Pham
T-Pham / BoomClap.json
Created April 10, 2018 08:34
BoomClap.json
{"data":[{"author":{"name":"Aleks","picture":{"s":"https://bandlab-test-images.azureedge.net/v1.0/Users/71c81538-4e88-e511-80c6-000d3aa03fb0/636016633463395803/360x360","m":"https://bandlab-test-images.azureedge.net/v1.0/Users/71c81538-4e88-e511-80c6-000d3aa03fb0/636016633463395803/640x640","l":"https://bandlab-test-images.azureedge.net/v1.0/Users/71c81538-4e88-e511-80c6-000d3aa03fb0/636016633463395803/1024x1024","xs":"https://bandlab-test-images.azureedge.net/v1.0/Users/71c81538-4e88-e511-80c6-000d3aa03fb0/636016633463395803/100x100","url":"https://bandlab-test-images.azureedge.net/v1.0/users/71c81538-4e88-e511-80c6-000d3aa03fb0/636016633463395803/"}},"createdOn":"2016-09-23T08:15:13Z","modifiedOn":"2016-09-23T08:15:13Z","picture":{"s":"https://bandlab-test-images.azureedge.net/v1.0/Users/71c81538-4e88-e511-80c6-000d3aa03fb0/636016633463395803/360x360","m":"https://bandlab-test-images.azureedge.net/v1.0/Users/71c81538-4e88-e511-80c6-000d3aa03fb0/636016633463395803/640x640","l":"https://bandlab-test-images.az
@T-Pham
T-Pham / Disco.brs
Created June 23, 2017 04:21
Roku Disco
sub init()
n = 50
m.n = n
for i = 0 to n * n - 1
c = i mod n + 1
r = Int(i / n) + 1
child = CreateObject("roSGNode", "Rectangle")
w = Int(1280 / n)
h = Int(720 / n)
child.width = w
@T-Pham
T-Pham / base64.txt
Created June 6, 2017 03:46
Base64 test string
eyJhIjoiPGE+Pz8/In0=
@T-Pham
T-Pham / gist:3d595db25271a0fbaa8e5e4076158ac7
Created April 7, 2017 05:18
Export test coverage from slather to shield.io badge html object
slather coverage \
--cobertura-xml \
--scheme "SchemeName" \
--workspace path/to/workspace \
XcodeProjectName.xcodeproj
xmlstarlet sel \
--template \
--match "//coverage[1]" \
--elem "object" \
@T-Pham
T-Pham / AlamofireSwiftyJSONSerializer.swift
Last active March 15, 2017 15:02
Alamofire SwiftyJSON Serializer
//
// AlamofireSwiftyJSONSerializer.swift
//
// Created by Thanh Pham on 7/21/16.
//
import Alamofire
import SwiftyJSON
extension Request {
@T-Pham
T-Pham / DeviceOptimizer.swift
Last active August 15, 2016 11:10
Convenient Swift method to run a closure of UI-optimizing code on some devices selectively based on their logical height
//
// DeviceOptimizer.swift
//
// Created by Thanh Pham on 8/4/16.
//
import UIKit
struct DeviceOptimizer {
@T-Pham
T-Pham / MyTextField.swift
Last active August 15, 2016 11:05
Custom UIControlEvents
struct MyTextFieldEvents: OptionSetType {
let rawValue: UInt
static let BackSpaceDidPress = MyTextFieldEvents(rawValue: 1 << 24)
}
class MyTextField: UITextField {
func addTarget(target: AnyObject?, action: Selector, forControlEvents controlEvents: MyTextFieldEvents) {
super.addTarget(target, action: action, forControlEvents: UIControlEvents(rawValue: controlEvents.rawValue))
}
@T-Pham
T-Pham / keybase.md
Created August 1, 2016 09:19
keybase.md

Keybase proof

I hereby claim:

  • I am t-pham on github.
  • I am tpham (https://keybase.io/tpham) on keybase.
  • I have a public key ASB2senYAAcq9Q0QhoCtDhc6fYJfbt1QTEsA8X7CZJi5fwo

To claim this, I am signing this object:

@T-Pham
T-Pham / tree.swift
Last active July 25, 2016 03:13
Mirror tree without recursion
class Node {
var id = 0
weak var parent: Node? = nil
var left: Node? = nil {
didSet {
left?.parent = self
}
}
var right: Node? = nil {
didSet {
@T-Pham
T-Pham / MacroFunctions.swift
Last active July 22, 2016 14:28
A wrapper function for Swift conditional compilation statements
//
// MacroFunctions.swift
//
// Created by Thanh Pham on 7/22/16.
//
func ifNotDebugDo(@noescape closure: Void -> Void) {
#if !DEBUG
closure()
#endif