Skip to content

Instantly share code, notes, and snippets.

View wlue's full-sized avatar

Wen-Hao Lue wlue

View GitHub Profile

Keybase proof

I hereby claim:

  • I am wlue on github.
  • I am wlue (https://keybase.io/wlue) on keybase.
  • I have a public key whose fingerprint is 245D F91A 660A 47EC E053 2FE7 33BC 1F4A C60A 4EE4

To claim this, I am signing this object:

@wlue
wlue / gist:7469286
Last active December 28, 2015 08:09
Open Chrome with a different config file on Mac OS X. Useful for testing on a clean set of cookies. Add to your .bashrc
# Open Chrome with a different config file. Add to your .bashrc
# Usage: chrome /tmp/test
function chrome () {
app="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
(
${app} --user-data-dir=$1 > /dev/null 2>&1
rm -r $1
) &
}
@wlue
wlue / MappedOrdering.scala
Created March 21, 2013 00:07
MappedOrdering
/**
* Defines an ordering for a list of keys of type K given an implicit ordering
* on value V and a mapping from K to V
*/
object MappedOrdering {
def withMapping[K, V](mapping: K => V)(implicit ordering: Ordering[V]) = {
new MappedOrdering[K, V](mapping)(ordering)
}
}
@wlue
wlue / gist:4462765
Created January 5, 2013 17:56
vim script that auto-indents and removes trailing whitespace. I used this to convert Obj-C projects from indents to spaces.
:set ts|retab " retab the whole file with magic
:%s/\v^\ +$// " remove whitespace in newline
:wq!
@wlue
wlue / UIView+Additions.h
Last active October 13, 2015 22:38
Convenient UIView methods that allow fast mutation of frame size and origin.
//
// UIView+Additions.h
//
// Created by Wen-Hao Lue on 12-01-08.
//
@interface UIView (Additions)
@property (nonatomic, assign) CGFloat frameX;
@property (nonatomic, assign) CGFloat frameY;