Skip to content

Instantly share code, notes, and snippets.

View NghiaTranUIT's full-sized avatar
💭
Workaholic 👨‍💻

Noah Tran NghiaTranUIT

💭
Workaholic 👨‍💻
View GitHub Profile
@NghiaTranUIT
NghiaTranUIT / network_security_config.md
Last active August 7, 2018 09:59
Config network_security_config.xml

Add a file res/xml/network_security_config.xml to your app:

<network-security-config> 
  <debug-overrides> 
    <trust-anchors> 
      <!-- Trust user added CAs while debuggable only -->
      <certificates src="user" /> 
    </trust-anchors> 
 
internal let DEFAULT_MIME_TYPE = "application/octet-stream"
internal let mimeTypes = [
"html": "text/html",
"htm": "text/html",
"shtml": "text/html",
"css": "text/css",
"xml": "text/xml",
"gif": "image/gif",
"jpeg": "image/jpeg",
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
struct VehicleCheck {
let sections: [Section]
}
public enum GitHub {
case zen
case userProfile(String)
case userRepositories(String)
}
extension GitHub: TargetType {
public var baseURL: URL { return URL(string: "https://api.github.com")! }
public var path: String {
switch self {
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
// -----------------------
// User obj
// + JSON decode
// + Transform to NSManagedObject
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
// Network service
// + Support plugins. For instance, Logger, Credential and NetworkActivity
// + Support Caching
func testOrdinaryCase() {
let input = "Linearity is the property of a mathematical relationship or function which means that it can be graphically represented as a straight line. Examples are the relationship of voltage and current across a resistor, or the mass and weight of an object."
let expected = ["1/6 Linearity is the property of a mathematical",
"2/6 relationship or function which means that it",
"3/6 can be graphically represented as a straight",
"4/6 line. Examples are the relationship of voltage",
"5/6 and current across a resistor, or the mass and",
"6/6 weight of an object."]
let output = Utils.split(input, limit: limit)
@NghiaTranUIT
NghiaTranUIT / TaskConcurrencyManifesto.md
Created August 18, 2017 10:45 — forked from lattner/TaskConcurrencyManifesto.md
Task-based concurrency manifesto draft

Concurrency in Swift: One possible approach

Introduction

This document is published in the style of a "Swift evolution manifesto", outlining a long-term view of how to tackle a very large problem. It explores one possible approach to adding a first-class concurrency model to Swift, in an effort to catalyze positive discussion that leads us to a best-possible design. As such, it isn't an approved or finalized design

@NghiaTranUIT
NghiaTranUIT / keybase.md
Created October 5, 2016 04:29
keybase.md

Keybase proof

I hereby claim:

  • I am nghiatranuit on github.
  • I am nghia (https://keybase.io/nghia) on keybase.
  • I have a public key whose fingerprint is AF90 870B 392D 5C28 09F4 C83E 6D04 83A6 9D4D F328

To claim this, I am signing this object:

@NghiaTranUIT
NghiaTranUIT / gist:6085141eb8f319adad6603969bfc5b33
Created May 2, 2016 04:20 — forked from masonforest/gist:4048732
Installing a Gem on Heroku from a Private GitHub Repo

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"