Skip to content

Instantly share code, notes, and snippets.

Avatar

Timothy Tsui timiscoding

  • Sydney, Australia
View GitHub Profile
@timiscoding
timiscoding / get_xcode.sh
Created Jul 19, 2020
download xcode bash script
View get_xcode.sh
#!/bin/bash
# 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
timiscoding / lvh_ssl.md
Last active Jun 20, 2018 — forked from dagjaneiro/lvh_ssl.md
lvh.me ssl
View lvh_ssl.md

Install nginx

$ brew install nginx

Edit nginx.conf

$ vim /usr/local/etc/nginx/nginx.conf
@timiscoding
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.
root
View interview_prep.md
@timiscoding
timiscoding / gist:fa1738fab1e43730259a
Created Feb 24, 2016
Technical interview question and answers
View gist:fa1738fab1e43730259a
https://gist.github.com/wofockham/63364ba0c264d103cadd#file-wdi12-interview-questions-ii-md
Group B
https://gist.github.com/alexwlee89/267d1e3b86f377c6eb26
Group A & C
@timiscoding
timiscoding / rails_postgres.md
Last active Dec 31, 2015
Rails app with seeded postgresql db
View rails_postgres.md

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
<?php
$myClientID = "myclientid";
$MyKey = "mykey";
$xml = file_get_contents("https://api.telstra.com/v1/oauth/token?client_id={$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, "https://api.telstra.com/v1/sms/messages");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);