Skip to content

Instantly share code, notes, and snippets.

View hboon's full-sized avatar

Hwee-Boon Yar hboon

View GitHub Profile
env = if ENV['dev'] == '1'
'dev'
elsif ENV['adhoc'] == '1'
'adhoc'
else
'dev' #default
end
if env == 'dev'
app.codesign_certificate = 'iPhone Developer: Hwee Boon Yar (something)'
@hboon
hboon / gist:8133537
Created December 26, 2013 12:57
testing for #dealloc called. #use_weak_callbacks is suppose to call #weak! on procs to break cyclic references.
it "verify #use_weak_callbacks" do
class ButtonParentView1 < UIView
def dealloc
p "dealloc #{self} tag: #{tag}"
super
end
def create_btn
sub2 = UIControl.alloc.init
sub2.when(UIControlEventTouchUpInside) do
@hboon
hboon / rubymotion-proc-leak
Created February 20, 2014 12:57
RubyMotion proc leak
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.makeKeyAndVisible
vc = UIViewController.new
vc.view.backgroundColor = UIColor.redColor
View.show_in_view(vc.view)
@window.rootViewController = vc
true

Keybase proof

I hereby claim:

  • I am hboon on github.
  • I am hboon (https://keybase.io/hboon) on keybase.
  • I have a public key whose fingerprint is 1545 BD4C CFD4 F2C8 3949 C3E6 2039 F178 DFE5 69B6

To claim this, I am signing this object:

@hboon
hboon / markdown.css
Created October 5, 2015 08:32 — forked from imjasonh/markdown.css
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@hboon
hboon / Check iOS hardware model.m
Last active October 19, 2015 17:34
Check iOS hardware model
//Courtesy of https://github.com/InderKumarRathore/DeviceUtil/blob/master/DeviceUtil.m
- (NSString*)moHardwareDescription {
NSString *hardware = [self moHardwareString];
if ([hardware isEqualToString:@"iPhone1,1"]) return @"iPhone 2G";
if ([hardware isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
if ([hardware isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";
if ([hardware isEqualToString:@"iPhone3,1"]) return @"iPhone 4";
if ([hardware isEqualToString:@"iPhone3,2"]) return @"iPhone 4";
if ([hardware isEqualToString:@"iPhone3,3"]) return @"iPhone 4 (CDMA)";
if ([hardware isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
@hboon
hboon / AVAsset+VideoOrientation.h
Created November 1, 2015 09:24 — forked from luca-bernardi/AVAsset+VideoOrientation.h
Find the video orientation of an AVAsset. (Useful if you need to send the video to a remote server)
//
// AVAsset+VideoOrientation.h
//
// Created by Luca Bernardi on 19/09/12.
// Copyright (c) 2012 Luca Bernardi. All rights reserved.
//
#import <AVFoundation/AVFoundation.h>
typedef enum {
LBVideoOrientationUp, //Device starts recording in Portrait
@hboon
hboon / gist:18cb1c14aae1a479bbad
Created January 19, 2016 04:06 — forked from eternalstorms/gist:4463450
Twitter Apple Accounts (media, pr, etc)
Steve Wozniak, Apple alumni and all-around amazing person - @stevewoz
Victor Agreda, Jr., TUAW - @superpixels
Mike T. Rose, TUAW - @miketrose
John Gruber, Daring Fireball - @gruber
Arnold Kim, MacRumors - @arnoldkim
Jason Snell, Macworld - @jsnell
Josh Lowensohn, CNET - @josh
Chris O'Brien, LA Times - @obrien
Mark Gurman, 9to5Mac - @markgurman
Matthew Panzarino, TNW - @panzer
@hboon
hboon / Apple Evangelists.txt
Created January 19, 2016 04:06 — forked from eternalstorms/Apple Evangelists.txt
Apple Evangelists (WWDC 2013)
UI- and App Frameworks Evangelist - Jake Behrens, behrens@apple.com, twitter: @Behrens
- What's new in Cocoa
- Accessibility in iOS
- Building User Interfaces for iOS 7
- Getting Started with UIKit Dynamics
- What's new in Cocoa Touch
- What's New With Multitasking
- Best Practices for Cocoa Animation
- Improving Power Efficiency with App Nap
- Introducing Text Kit
@hboon
hboon / fix-message
Created July 24, 2016 08:05
Reset iMessage badge when it's stuck at 1
#!/bin/bash
killall Messages
killall Dock
open -a Messages