Skip to content

Instantly share code, notes, and snippets.

View makzan's full-sized avatar
🎯
Focusing

Thomas Seng Hin Mak makzan

🎯
Focusing
View GitHub Profile
{
"coord": {
"lon": 113.546112,
"lat": 22.20056
},
"sys": {
"country": "MO",
"sunrise": 1383690767,
"sunset": 1383731168
},
@makzan
makzan / wifi-password.php
Created September 1, 2018 07:49
Example code for PHP class
<?php
// DATA
$passwords = [
"John" => "1357",
"Susan" => "2468",
"Steven" => "1890",
"Steve" => "9876"
];
@makzan
makzan / simple-questions.php
Created September 1, 2018 07:49
Example code for PHP class
<?php
// DATA
$questions=[];
$questions[] = [
"q" => "1+2",
"ans" => "3"
];
$questions[] = [
"q" => "3x5",
"ans" => "15"
@makzan
makzan / student-list.php
Created September 1, 2018 07:48
Example code for PHP class
<?php
// DATA
$students = [];
$students[] = [
"name" => "Thomas Mak",
"class" => "S1A",
"number" => 32,
"enrolled_classes" => [
"Chinese",
@makzan
makzan / quick-editor.html
Created August 23, 2018 00:29
Quick HTML/CSS/JS editor
<title>
WebCode.run Editor
</title>
<style>
* { box-sizing: border-box; }
html, body {
margin: 0;
padding: 0;
}
@makzan
makzan / .htaccess
Created August 10, 2015 07:27
Remove "public" in URL in Laravel 5.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
@makzan
makzan / mailgun.swift
Created June 11, 2015 01:16
Send mail via Mailgun from iOS Swift with Alamofire
let key = "<YOUR-KEY>"
let parameters = [
"from": "<FROM-EMAIL>",
"to": "<TO-EMAIL>",
"subject": "<SUBJECT>",
"text": "<CONTENT>"
]
let r = Alamofirerequest(.POST, "https://api.mailgun.net/v3/<MAILGUN-DOMAIN>/messages", parameters:parameters)
@makzan
makzan / createjs-starting-point-with-retinalize.js
Created January 1, 2016 05:05
CreateJS starting point with Retina support
class App {
constructor() {
this.canvas = document.getElementById("app-canvas");
this.stage = new createjs.Stage(this.canvas);
this.retinalize();
createjs.Ticker.setFPS(60);
@makzan
makzan / basic-login.php
Created September 29, 2017 13:51
Basic PHP hardcoded login/logout
<?php
session_id("thomas23");
session_start();
// initialize the login name session variable.
$_SESSION["login_name"] = $_SESSION["login_name"] ?? "";
// there is data POST from user.
if (count($_POST) > 0) {
@makzan
makzan / count.php
Created September 29, 2017 12:52
Test PHP $_SESSION
<?php
session_id("thomas23");
session_start();
if (!isset($_SESSION["q_num"]) ){
$_SESSION["q_num"] = 0;
}