Skip to content

Instantly share code, notes, and snippets.

@eunjae-lee
eunjae-lee / parcelable.html
Created June 4, 2014 14:23
Android - parcelable model class generator
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<title>parcelable</title>
</head>
<body>
<input type="text" id="className" placeholder="className" value="" />
<textarea id="textarea" style="width:600px; height:400px;"></textarea>
<input type="button" id="button" value="generate!" />
{
"name": "Eunjae Lee",
"noshow": false,
"albuminfo": {
"count": 10
}
}
public static String generateDeviceUniqueId() {
Context context = WithApplication.getInstance().getApplicationContext();
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
final String tmDevice, tmSerial, androidId;
tmDevice = "" + tm.getDeviceId();
tmSerial = "" + tm.getSimSerialNumber();
androidId = "" + android.provider.Settings.Secure.getString(context.getContentResolver(),
android.provider.Settings.Secure.ANDROID_ID);
function openTwitterShare() {
var msg = ".......";
window.open(
'https://twitter.com/intent/tweet?source=webclient&text='+encodeURIComponent(msg),
'twitter',
'width=626,height=330');
}
function openFacebookShare() {
var url = "........";
@eunjae-lee
eunjae-lee / gist:3793233
Created September 27, 2012 09:59
Get Html5 Video Url of Youtube
url = document.getElementsByTagName('video')[0].src
console.log(url);
@eunjae-lee
eunjae-lee / gist:3793227
Created September 27, 2012 09:58
Get subtitle from Youtube as SMI format
var smi = [];
smi.push("<SAMI><BODY>");
$('#transcript-scrollbox .caption-line').map(function (idx, item) {
var time = parseInt(($(item).attr('data-time') - 0)*1000);
var text = $('.caption-line-text', $(item)).html()
smi.push("<SYNC Start=" + time + "><P Class=ENCC>" + text + "\n");
});
smi.push("</BODY></SAMI>");
@eunjae-lee
eunjae-lee / gist:3491069
Created August 27, 2012 18:22
Get WordPress Posts via XmlRcp from JavaScript
var wpService = new rpc.ServiceProxy("http://blahblah/xmlrpc.php", {
asynchronous: true,
protocol: "XML-RPC",
sanitize: false,
methods: ['wp.getPosts']
});
rpc.setDateRegexp(wpService, /^(\d\d\d\d)(\d\d)(\d\d)T(\d\d):(\d\d):(\d\d)$/);
wpService.wp.getPosts({
@eunjae-lee
eunjae-lee / gist:3180732
Created July 26, 2012 07:22
HTML5 Basic Snippet
<!DOCTYPE html>
<html lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width" />
<title></title>
<link href="css/style.css" rel="stylesheet" />
</head>
@eunjae-lee
eunjae-lee / hogan-express-adapter
Created July 18, 2012 16:59
hogan-express adapter
###
hogan-express.coffee
###
exports.init = (hogan, fs) ->
return (path, options, fn) ->
fs.readFile path, 'utf8', (err, str) ->
return fn(err) if err
result = hogan.compile(str).render(options)
fn null, result