Skip to content

Instantly share code, notes, and snippets.

Working from home

Leo Kwan leojkwan

Working from home
Block or report user

Report or block leojkwan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nbasham / gist:c6af488949dc3435e43b3d3cba9d4df4
Last active May 8, 2017
A sizable UIViewController that can be used as a playground liveView and set to specific device sizes.
View gist:c6af488949dc3435e43b3d3cba9d4df4
import UIKit
import PlaygroundSupport
public class DeviceViewController : UIViewController {
public enum ScreenType : Int {
case iPhone3_5Inch
case iPhone4Inch // includes 5th & 6h gen iPod Touch
case iPhone4_7Inch
case iPhone5_5Inch
glarrain /
Last active Jun 16, 2019 — forked from jonyt/connect_heroku_to_amazon_rds
How to connect a Heroku application to an Amazon RDS PostgreSQL instance, forcing SSL and certificate chain verification

1 - Download the RDS certificates (root plus region-specific intermediate ones) bundle:

wget -O config/rds-combined-ca-bundle.pem

2 - Add config/rds-combined-ca-bundle.pem to the repository and redeploy to Heroku.

3 - Update the DATABASE_URL env var:

hanksudo / list_supported_fonts.swift
Created Apr 15, 2016
List all supported fonts on iOS
View list_supported_fonts.swift
for (familyName) in UIFont.familyNames() {
print("\nFamily: ", familyName.utf8)
let fontNames = UIFont.fontNamesForFamilyName(familyName)
for (fontName) in fontNames {
print("\tFont: ", fontName.utf8)
View ProtocolFusion.swift
//: Playground - noun: a place where people can play
import UIKit
protocol Foo {
protocol Bar {
staltz /
Last active Nov 14, 2019
The introduction to Reactive Programming you've been missing
charlesdaniel / basic_auth_nodejs_test.js
Created Jan 27, 2012
Example of HTTP Basic Auth in NodeJS
View basic_auth_nodejs_test.js
var http = require('http');
var server = http.createServer(function(req, res) {
// console.log(req); // debug dump the request
// If they pass in a basic auth credential it'll be in a header called "Authorization" (note NodeJS lowercases the names of headers in its request object)
var auth = req.headers['authorization']; // auth is in base64(username:password) so we need to decode the base64
console.log("Authorization Header is: ", auth);
You can’t perform that action at this time.