Skip to content

Instantly share code, notes, and snippets.

View timiscoding's full-sized avatar

Timothy Tsui timiscoding

  • Sydney, Australia
View GitHub Profile
<?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);
@timiscoding
timiscoding / gist:d972ed44dc4a63974bb0
Last active December 22, 2015 06:04
Project 0 - WDI 12
@timiscoding
timiscoding / rails_postgres.md
Last active December 31, 2015 07:33
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
@timiscoding
timiscoding / gist:fa1738fab1e43730259a
Created February 24, 2016 01:06
Technical interview question and answers
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 / WebpackFileDirnamePlugin
Created June 14, 2018 04:52
Webpack node plugin makes __dirname / __filename return absolute paths based on input file name
/* 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
@timiscoding
timiscoding / lvh_ssl.md
Last active June 20, 2018 06:54 — forked from dagjaneiro/lvh_ssl.md
lvh.me ssl

Install nginx

$ brew install nginx

Edit nginx.conf

$ vim /usr/local/etc/nginx/nginx.conf
@timiscoding
timiscoding / get_xcode.sh
Created July 19, 2020 06:03
download xcode bash script
#!/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"