Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Thomas Seng Hin Mak makzan

🎯
Focusing
Block or report user

Report or block makzan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@makzan
makzan / ViewController.swift
Created Apr 9, 2019
Demo on uploading image to PHP from Alamofire
View ViewController.swift
//
// ViewController.swift
// Upload Image Example
//
import UIKit
import Alamofire
class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
View Sorted_by.swift
import Foundation
class Student {
var enrolledAt:Date = Date()
init(enrolledAt:String) {
let dateFormatter = ISO8601DateFormatter()
dateFormatter.formatOptions = .withFullDate
self.enrolledAt = dateFormatter.date(from: enrolledAt)!
}
View example-openweather-output.json
{
"coord": {
"lon": 113.546112,
"lat": 22.20056
},
"sys": {
"country": "MO",
"sunrise": 1383690767,
"sunset": 1383731168
},
@makzan
makzan / wifi-password.php
Created Sep 1, 2018
Example code for PHP class
View wifi-password.php
<?php
// DATA
$passwords = [
"John" => "1357",
"Susan" => "2468",
"Steven" => "1890",
"Steve" => "9876"
];
@makzan
makzan / simple-questions.php
Created Sep 1, 2018
Example code for PHP class
View simple-questions.php
<?php
// DATA
$questions=[];
$questions[] = [
"q" => "1+2",
"ans" => "3"
];
$questions[] = [
"q" => "3x5",
"ans" => "15"
@makzan
makzan / student-list.php
Created Sep 1, 2018
Example code for PHP class
View student-list.php
<?php
// DATA
$students = [];
$students[] = [
"name" => "Thomas Mak",
"class" => "S1A",
"number" => 32,
"enrolled_classes" => [
"Chinese",
@makzan
makzan / quick-editor.html
Created Aug 23, 2018
Quick HTML/CSS/JS editor
View quick-editor.html
<title>
WebCode.run Editor
</title>
<style>
* { box-sizing: border-box; }
html, body {
margin: 0;
padding: 0;
}
@makzan
makzan / basic-login.php
Created Sep 29, 2017
Basic PHP hardcoded login/logout
View basic-login.php
<?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 Sep 29, 2017
Test PHP $_SESSION
View count.php
<?php
session_id("thomas23");
session_start();
if (!isset($_SESSION["q_num"]) ){
$_SESSION["q_num"] = 0;
}
View guest-room-wifi.php
<?php
$name = $_POST["name"] ?? "";
$is_allowed = false;
if ($name == "Thomas") {
$is_allowed = true;
}
You can’t perform that action at this time.