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 / introrx.md
Created February 19, 2016 13:54 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

Difference between Debounce and Throttle

Debounce

Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.

Throttle

@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"

@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 / 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

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)
//: 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
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
// -----------------------
// User obj
// + JSON decode
// + Transform to NSManagedObject
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"
struct VehicleCheck {
let sections: [Section]
}