Skip to content

Instantly share code, notes, and snippets.

View leojkwan's full-sized avatar
🏠
Working from home

Leo Kwan leojkwan

🏠
Working from home
View GitHub Profile
@nbasham
nbasham / gist:c6af488949dc3435e43b3d3cba9d4df4
Last active May 8, 2017 11:08
A sizable UIViewController that can be used as a playground liveView and set to specific device sizes.
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
glarrain / connect-heroku-app-to-postgres-rds-with-ssl.md
Last active January 4, 2023 14:01 — 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 https://s3.amazonaws.com/rds-downloads/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
hanksudo / list_supported_fonts.swift
Created April 15, 2016 18:07
List all supported fonts on iOS
for (familyName) in UIFont.familyNames() {
print("\nFamily: ", familyName.utf8)
let fontNames = UIFont.fontNamesForFamilyName(familyName)
for (fontName) in fontNames {
print("\tFont: ", fontName.utf8)
}
}
//: Playground - noun: a place where people can play
import UIKit
protocol Foo {
}
protocol Bar {
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active April 8, 2024 18:07
The best FRP iOS resources.

Videos

@vinhnx
vinhnx / remove_unused_localization.md
Last active October 31, 2021 05:33
Remove usused localizations from pods

Update 4/10/2017: updated script working with Cocoapod 1.3.1

... If you are using CocoaPods, you may want to remove unwanted localizations using the pre install script below. Modify the supported_locales array to match your supported locales and paste it into your Podfile.

Note the all lowercase

platform :ios, '9.0'
@staltz
staltz / introrx.md
Last active April 20, 2024 14:15
The introduction to Reactive Programming you've been missing
@charlesdaniel
charlesdaniel / basic_auth_nodejs_test.js
Created January 27, 2012 02:53
Example of HTTP Basic Auth in NodeJS
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);