Skip to content

Instantly share code, notes, and snippets.

View hunje's full-sized avatar

Hunje Cho hunje

  • cocone corporation.
  • Tokyo, Japan
View GitHub Profile
@hunje
hunje / HTDebug.h
Last active December 19, 2015 08:19
Log macro for iOS
#if defined(DEBUG)
#define HTLog(__VA_ARGS__) NSLog(__VA_ARGS__)
#define HTLog2(fmt, ...) NSLog((fmt), ##__VAR_ARGS__)
#else
#define HTLog(__VA_ARGS__) while (FALSE) { }
#endif
@hunje
hunje / HTWait.h
Last active December 22, 2015 23:19
The helper class for asynchronous wait with timeout and simple signal.
#import <Foundation/Foundation.h>
@interface HTWait : NSObject
{
BOOL signaled;
}
- (void)prepare;
- (void)signal;
- (void)waitForTimeout:(NSTimeInterval)timeOut;
@hunje
hunje / .vimrc
Last active August 29, 2015 13:56
VIMRC
" line number and length
set number
" set tw=79 " Width of document
set nowrap
set fo-=t " dont' automaticall wrap text when typing
set colorcolumn=80
highlight ColorColumn ctermbg=233
set ruler
" syntax highlight
@hunje
hunje / p4diff
Last active August 29, 2015 14:10
p4merge shell script
#!/usr/bin/env bash
P4MERGE=/Applications/p4merge.app/Contents/MacOS/p4merge
[ $# -eq 7 ] && ${P4MERGE} "$2" "$5"
@hunje
hunje / sleep.sh
Created December 10, 2014 04:17
Sleep My mac via command line
pmset sleepnow
@hunje
hunje / exportLibrary.java
Created March 11, 2015 05:08
Export Photo to Android's Photo Library
public static void exportToPhoto(File src) {
String srcFilePath = src.getAbsolutePath();
String targetFileName = srcFilePath.substring(srcFilePath.lastIndexOf('/') + 1);
try {
File outputFile = new File(getPublicExternalPicturePath(), targetFileName);
copyFile(src, outputFile);
MediaScannerConnection.scanFile(mActivity,
new String[] {outputfile.toString() }, null,
new MediaScannerConnection.OnScanCompletedListener() {
@hunje
hunje / copyFile.java
Created March 11, 2015 05:10
Copy File Android
public static void copyFile(File src, File target) throws FileNotFoundException, IOException {
FileInputStream inStream = new FileInputStream(src);
FileOutputStream outStream = new FileOutputStream(target);
FileChannel inChannel = inStream.getChannel();
FileChannel outChannel = outStream.getChannel();
inChannel.transferTo(0, inChannel.size(), outChannel);
inStream.close();
outStream.close();
}
@hunje
hunje / git-get-branch-name
Created March 31, 2015 12:29
Shows current branch's name
#!/usr/bin/env bash
git rev-parse --abbrev-ref HEAD
@hunje
hunje / p4merge
Created June 12, 2015 05:44
p4merge
#!/usr/bin/env bash
/Applications/p4merge.app/Contents/MacOS/p4merge $*
@hunje
hunje / .profile
Created June 12, 2015 09:51
Default LS_COLORS
export LS_COLORS="di=00;34:ln=00;35:so=00;32:pi=01;33:ex=00;31:bd=00;34"