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
@makzan
makzan / box2d-alias.js
Created April 22, 2014 06:41
Box2D Alias
// alias var 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 ;
<!doctype html>
<html>
<head>
<!-- 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
makzan / gist:4e39b40bf758a1378b44
Created September 8, 2014 02:38
Orphans Fixer without jQuery
# 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
makzan / gist:83c0e48a4cb660787970
Created October 20, 2014 09:10
Basic usage of UIActivityViewController
- (IBAction)shareAction:(id)sender {
NSString *title = [NSString stringWithFormat:@"I'm reading this great product: %@",self.titleLabel.text];
NSURL *url = [NSURL URLWithString:@"http://example.com"];
UIActivityViewController *actionController = [[UIActivityViewController alloc] initWithActivityItems:@[title, url] applicationActivities:nil];
[self.navigationController presentViewController:actionController animated:YES completion:nil];
}

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
makzan / example
Last active August 29, 2015 14:27
https://www.dropbox.com/s/nmh10tmsdkto1u1/Testing%20Client%20A.zip?dl=0
@makzan
makzan / UIDevice+hardware.m
Created August 18, 2011 10:46
Getting iPhone device model
#import "UIDevice+hardware.h"
#include <sys/types.h>
#include <sys/sysctl.h>
@implementation UIDevice (Hardware)
/*
Platforms
iPhone1,1 -> iPhone 1G
iPhone1,2 -> iPhone 3G
@makzan
makzan / radar.css
Created November 6, 2011 17:41
Rotatable radar in HTML and CSS
html, body{
background: transparent;
}
ul,li{
margin:0;
list-style:none;
}
li {
@makzan
makzan / gist:1963105
Created March 3, 2012 00:59
Logging to Day One from git commit
# modification code for the "git to log commits to Day One"
# at http://brettterpstra.com/logging-with-day-one-geek-style/
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/"
}
# And use the branch name in the log message
GIT_DIR=$(parse_git_branch)
@makzan
makzan / using-foundation-reveal.js
Created August 22, 2012 08:14
About Using Reveal Modal in Zurb Foundation CSS Framework
// About Using Reveal Modal in Zurb Foundation CSS Framework
// Show a modal (documented in Foundation doc)
$('#modal').reveal(options)
// The followings are not documented in Foundation doc.
// Close a modal
$('#modal').trigger('reveal:close');
// Close all modal