Skip to content

Instantly share code, notes, and snippets.


Timothy Tsui timiscoding

  • Sydney, Australia
View GitHub Profile
timiscoding /
Created Jul 19, 2020
download xcode bash script
# This script downloads xcode at a speed of your choice so that you still have usable internet.
# Requires an Apple Developer account.
# command to schedule 'script' to run at 'time' using 'at' util
# at <time> -f <script>
getFile () {
# -O use the same filename as the url, -C - resume download from end of partial file, set max 300kbps download rate
params="-O -C - --limit-rate 300k"
timiscoding /
Last active Jun 20, 2018 — forked from dagjaneiro/ ssl

Install nginx

$ brew install nginx

Edit nginx.conf

$ vim /usr/local/etc/nginx/nginx.conf
timiscoding / WebpackFileDirnamePlugin
Created Jun 14, 2018
Webpack node plugin makes __dirname / __filename return absolute paths based on input file name
View WebpackFileDirnamePlugin
/* eslint-disable class-methods-use-this */
/* This plugin changes the way __dirname and __filename behave by returning absolute
dirname or filename from the *input* file instead of where the module is executed
(which can change depending on the build environment).
For instance, you might have the bundled file in root/dist in production while
in a testing environment it may go in root/test/.tmp/mocha.
timiscoding / gist:fa1738fab1e43730259a
Created Feb 24, 2016
Technical interview question and answers
View gist:fa1738fab1e43730259a
Group B
Group A & C
timiscoding /
Last active Dec 31, 2015
Rails app with seeded postgresql db

Creating a rails app with a prepopulated postgres db

Prerequisite: make sure Postgres is started! You should see the elephant icon in the menu bar

Plural for table names and controller names, singular for models

  1. Create a new project using postgresql.
rails new projectName -d postgresql
View telstraSMS
$myClientID = "myclientid";
$MyKey = "mykey";
$xml = file_get_contents("{$myClientID}&client_secret={$MyKey}&grant_type=client_credentials&scope=SMS");
$json_a = json_decode($xml, true);
$access_token = $json_a["access_token"];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);