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 / RootUtil.java
Created August 20, 2014 01:19
How to detect that a device is rooted in Android
package com.booknara.android;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import android.util.Log;
@booknara
booknara / gist:7ab408b87a253dcb026d
Last active August 29, 2015 14:05
How to detect whether the device is a tablet or phone in Android programmatically
09-04 13:38:20.219 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ Start session with context: com.zerodesktop.appdetox.dinnertime.control.ui.application.AppsActivity@64e590a8 count:0
09-04 13:38:22.772 16987-23315/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ FlurryDataSender: report 94b1317f-ef93-48c1-b874-9cf6488d5183 sent. HTTP response: 200
09-04 13:38:29.960 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ Start session with context: com.zerodesktop.appdetox.dinnertime.control.ui.device.MainActivity@64fc12a0 count:1
09-04 13:38:30.941 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ End session with context: com.zerodesktop.appdetox.dinnertime.control.ui.application.AppsActivity@64e590a8 count:1
09-04 13:38:37.328 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ Event count started: /apps
09-04 13:38:37.398 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ Start session with context: com.zerodesktop.
@booknara
booknara / SimpleAlertDialog.java
Last active April 11, 2016 05:45
Android AlertDialog Template code
/**
* Android Simple AlertDialog BoilerPlate Code
*
* @author Daehee Han ([email protected])
* @since 05/15/2014
* @version 1.0.0
*
*/
import android.app.Activity;
@booknara
booknara / BaseActivity.java
Created May 15, 2014 23:48
Android Activity BoilerPlate Code
/**
* Android Activity BoilerPlate Code
*
* @author Daehee Han ([email protected])
* @since 05/15/2014
* @version 1.0.0
*
*/
import android.app.ActionBar;
@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 / 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 / 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 / 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 / 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 / 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();