Skip to content

Instantly share code, notes, and snippets.


Thomas Seng Hin Mak makzan

View GitHub Profile
makzan / gist:6521456
Created Sep 11, 2013
time zone examples
View gist:6521456
View box2d-alias.js
// aliasvar b2Vec2 = Box2D.Common.Math.b2Vec2, b2AABB = Box2D.Collision.b2AABB, b2BodyDef = Box2D.Dynamics.b2BodyDef, b2Body = Box2D.Dynamics.b2Body, b2FixtureDef = Box2D.Dynamics.b2FixtureDef, b2Fixture = Box2D.Dynamics.b2Fixture, b2World = Box2D.Dynamics.b2World, b2MassData = Box2D.Collision.Shapes.b2MassData, b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape, b2CircleShape = Box2D.Collision.Shapes.b2CircleShape, b2DebugDraw = Box2D.Dynamics.b2DebugDraw, b2MouseJointDef = Box2D.Dynamics.Joints.b2MouseJointDef, b2RevoluteJointDef = Box2D.Dynamics.Joints.b2RevoluteJointDef;
View ScaleBitmap.js
// copy from
// in case that pull request is removed.
* ScaleBitmap
* Visit for documentation, updates and examples.
* Copyright (c) 2010, inc.
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
View iOS-7-web-app.html
<!doctype html>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
makzan / gist:4e39b40bf758a1378b44
Created Sep 8, 2014
Orphans Fixer without jQuery
View gist:4e39b40bf758a1378b44
# Orphans Fixer
all_paragraphs = document.querySelectorAll('p, h1, h2, h3, li')
window.p = all_paragraphs[0]
reg = /\s([^\s<]{0,10})\s*$/
for p in all_paragraphs
p.innerHTML = p.innerHTML.replace reg, "&nbsp$1"
makzan / gist:83c0e48a4cb660787970
Created Oct 20, 2014
Basic usage of UIActivityViewController
View gist:83c0e48a4cb660787970
- (IBAction)shareAction:(id)sender {
NSString *title = [NSString stringWithFormat:@"I'm reading this great product: %@",self.titleLabel.text];
NSURL *url = [NSURL URLWithString:@""];
UIActivityViewController *actionController = [[UIActivityViewController alloc] initWithActivityItems:@[title, url] applicationActivities:nil];
[self.navigationController presentViewController:actionController animated:YES completion:nil];
makzan / index.html
Created Nov 23, 2014
Very basic TODO list with jQuery and LocalStorage // source
View index.html
<!DOCTYPE html>
<meta name="description" content="TODO List Example" />
<script src=""></script>
<meta charset="utf-8">
<title>TODO List</title>
<style id="jsbin-css">
.templates {
display: none;
View My 11 tips on playing Tap

My 11 tips on playing Tap Titans:

  1. Turn off auto locking to keep the game active. Occasionally tap the flying chests to gain extra gold and diamond.
  2. Turn off the screen when you need focus on work, then come back to the game later to gain a batch of mined gold. (On the upper left icon)
  3. Only spend diamonds on “Make in Rain”.
  4. Look at the Achievement list and finish the tasks there to gain lots of diamonds. When there are spare diamonds, spend on “Make it Rain”.
  5. Spending the diamonds should always be the last choice. I will spend diamonds only when I have more than 200.
  6. Carefully choose which champions to level up at certain time. Sometimes you want more damages. Sometimes you want more gold generation. For me, I go for damages at early game and gold generation since middle game.
  7. Spend diamond to break your Artifact if you don’t like it. Artifacts are totally random, it worths spending the diamonds to generate a new one that works for your styles.
makzan / mailgun.swift
Created Jun 11, 2015
Send mail via Mailgun from iOS Swift with Alamofire
View mailgun.swift
let key = "<YOUR-KEY>"
let parameters = [
"from": "<FROM-EMAIL>",
"to": "<TO-EMAIL>",
"subject": "<SUBJECT>",
"text": "<CONTENT>"
let r = Alamofirerequest(.POST, "<MAILGUN-DOMAIN>/messages", parameters:parameters)
makzan / .htaccess
Created Aug 10, 2015
Remove "public" in URL in Laravel 5.
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]