Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Hank Bao hankbao

🎯
Focusing
Block or report user

Report or block hankbao

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
@hankbao
hankbao / sideproject_marketing_checklist.md
Created Aug 14, 2017
The Side Project Marketing Checklist
View sideproject_marketing_checklist.md
layout title permalink
checklist_page
The Side Project Marketing Checklist
/marketing-checklist/

Pre-Launch

Market Research

@hankbao
hankbao / aac_hardware_decoder_detect.m
Last active Aug 12, 2017
Using AudioFormat to check the availability of the AAC hardware encoder.
View aac_hardware_decoder_detect.m
// Check this: https://developer.apple.com/library/content/qa/qa1663/_index.html
Boolean IsAACHardwareEncoderAvailable(void)
{
Boolean isAvailable = false;
OSStatus error;
// get an array of AudioClassDescriptions for all installed encoders for the given format
// the specifier is the format that we are interested in - this is 'aac ' in our case
UInt32 encoderSpecifier = kAudioFormatMPEG4AAC;
UInt32 size;
@hankbao
hankbao / Breakpoints_v2.xcbkptlist
Created Jul 14, 2017 — forked from Ashton-W/Breakpoints_v2.xcbkptlist
My User Breakpoints_v2.xcbkptlist
View Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<!-- All Exceptions -->
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
@hankbao
hankbao / sudoku.hs
Created Oct 30, 2015 — forked from kristopherjohnson/sudoku.hs
Sudoku solver in Haskell
View sudoku.hs
#!/usr/bin/env runhaskell
-- Note: For a slight improvement in performance, import the non-portable
-- Data.Array.Unboxed module instead of Data.Array, and change the Board
-- type below to use "UArray" instead of "Array".
import Data.Array
-- Solve the example puzzle specified below
-- TODO: read puzzle from input
main = do
@hankbao
hankbao / Fuckgfw.conf
Created Oct 12, 2015 — forked from jason5ng32/surge.conf
Surge Config
View Fuckgfw.conf
[General]
loglevel = notify
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24
[Proxy]
// ADD YOUR PROXY HERE, DON'T FORGET TO REMOVE #
# Proxy = http,$IP,$PORT,$USERNAME,$PASSWORD
# Proxy = https,$IP,$PORT,$USERNAME,$PASSWORD
@hankbao
hankbao / UIDeivce+Processes.m
Created Sep 18, 2015
UIDevice Category For Processes
View UIDeivce+Processes.m
// .h
@interface UIDevice (ProcessesAdditions)
- (NSArray *)runningProcesses;
@end
// .m
#import <sys/sysctl.h>
@implementation UIDevice (ProcessesAdditions)
View GCDMulticastDelegate.h
#import <Foundation/Foundation.h>
@class GCDMulticastDelegateEnumerator;
/**
* This class provides multicast delegate functionality. That is:
* - it provides a means for managing a list of delegates
* - any method invocations to an instance of this class are automatically forwarded to all delegates
*
* For example:
@hankbao
hankbao / ClosureStackOverflow.swift
Created May 13, 2015
call() and get a stack overflow
View ClosureStackOverflow.swift
import Swift
class ClosureStackOverflow {
private var b: Bool = false
private func callClosure1(callback: Void -> Void) {
println("in closure 1")
callback()
}
private func callClosure2(callback: Void -> Void) {
@hankbao
hankbao / reset_nic.sh
Created Apr 11, 2013
Reset network interfaces on OS X
View reset_nic.sh
#!/bin/sh
sudo ifconfig en0 down
sudo ifconfig en1 down
sudo route -n flush
sudo ifconfig en0 up
sudo ifconfig en1 up
@hankbao
hankbao / gist:5194309
Created Mar 19, 2013
Chop a rectangle from another rectangle on iOS
View gist:5194309
static
void divide_rect_from_rects(CGRect rect1, CGRect rect2, CGRect *slice, CGRect *remainder, CGRectEdge edge)
{
NSCParameterAssert(slice);
NSCParameterAssert(remainder);
CGRect intersected = CGRectIntersection(rect1, rect2);
if (CGRectIsEmpty(intersected)) {
*slice = CGRectNull;
return;
You can’t perform that action at this time.