Skip to content

Instantly share code, notes, and snippets.

View booknara's full-sized avatar

Daehee Han booknara

  • Facebook.Inc
  • San Jose, CA
View GitHub Profile
@booknara
booknara / abc.json
Created February 22, 2013 01:36
This file is for testing CORS(Cross-Origin-Resource-Sharing). You need to change Server configuration. Also, the server should have a json file like abc.json to request.
[
"bbb",
"ccc"
]
@booknara
booknara / gist:5536207
Created May 7, 2013 21:18
Centering div element onto the window.
div.classname {
position: absolute;
left: 50%; /* Start with top left in the center */
top: 50%;
width: 200px; /* The div fixed width... */
height: 100px; /* ...and height */
margin-left: -100px; /* Shift over half the width */
margin-top: -50px; /* Shift up half the height */
}
@booknara
booknara / gist:5536243
Created May 7, 2013 21:22
CORS Test file(GET)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>MDN Example &ndash; AJAX and forms</title>
<script type="text/javascript">
function AJAXGet(oForm) {
if (oForm.method.toLowerCase() !== "get") { return; }
var query = [];
var xhr = new XMLHttpRequest();
@booknara
booknara / gist:5550708
Created May 9, 2013 21:19
Prevent Single Clicks when double clicks is fired.
// Preventing single click when double-click is fired
var DELAY = 300, clicks = 0, time = null;
function handleSingleEvent(event)
{
clicks++;
if (clicks == 1)
{
timer = setTimeout( function() {
// performing action
@booknara
booknara / img_extractor.py
Last active July 12, 2016 05:01
This script help you extract image files from an APK file. Basic Usage (1) img_extractor.py --ifile <APK file> --ofile <Destination Directory> (2) img_extractor.py --ifile <APK file> --ofile . (3) img_extractor.py --ifile <APK file> --ofile ..
#!/usr/bin/python
# This script help you extract image files from an APK file.
# Author : Daehee Han (https://github.com/booknara, @daniel_booknara)
# Date : August 21 2013
# Basic Usage
# (1) img_extractor.py --ifile <APK file> --ofile <Destination Directory>
# (2) img_extractor.py --ifile <APK file> --ofile .
# (3) img_extractor.py --ifile <APK file> --ofile ..
@booknara
booknara / UserProfileKey.java
Last active December 26, 2015 04:09
Object Key combining multiple variables for using a key
package com.daeheehan.cache;
public class UserProfileKey implements Comparable<UserProfileKey>{
private String userId;
private String deviceId;
public UserProfileKey(String userId, String deviceId) {
this.userId = userId;
this.deviceId = deviceId;
}
@booknara
booknara / ListViewUtil.java
Last active March 5, 2018 02:24
ListView Adjustment(Height) in ScrollView
package com.daeheehan.util;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.ListView;
/**
* List View Utility
@booknara
booknara / adb_install.sh
Created April 1, 2014 21:28
Shell Script for installing a APK file to all mounted devices.
#!/bin/bash
# Description : You can install APK file to all mounted devices
# Checking Command Line
if [ $# -ne 1 ]
then
echo "Usage : $0 \<APK file name\> "
exit 2
fi
@booknara
booknara / BaseActivity.java
Created May 15, 2014 23:48
Android Activity BoilerPlate Code
/**
* Android Activity BoilerPlate Code
*
* @author Daehee Han (bookdori81@gmail.com)
* @since 05/15/2014
* @version 1.0.0
*
*/
import android.app.ActionBar;
@booknara
booknara / SimpleAlertDialog.java
Last active April 11, 2016 05:45
Android AlertDialog Template code
/**
* Android Simple AlertDialog BoilerPlate Code
*
* @author Daehee Han (bookdori81@gmail.com)
* @since 05/15/2014
* @version 1.0.0
*
*/
import android.app.Activity;