Skip to content

Instantly share code, notes, and snippets.

View zlargon's full-sized avatar
:electron:
Focusing

Leon Huang zlargon

:electron:
Focusing
  • Boston, MA
View GitHub Profile
@zlargon
zlargon / CloudService.java
Last active December 14, 2016 07:21
An Example of Java Interface
public class CloudService {
// LoginCallback interface
static public interface LoginCallback {
public void onSuccess(final String loginId, final String token);
public void onFailure(final String loginId, final int errorCode);
}
// login method
static public void login(
@zlargon
zlargon / private.xml
Last active July 10, 2016 02:27
[karabiner] 將滑鼠側鍵對到 shift(左)
<?xml version="1.0"?>
<root>
<item>
<name>My Shift</name>
<identifier>private.myshift</identifier>
<autogen>__KeyToKey__ PointingButton::BUTTON4, KeyCode::SHIFT_L</autogen>
</item>
</root>
@zlargon
zlargon / mayday.html
Created June 25, 2016 10:35
tixcraft Hacking
<select name="dateSearchGameList" id="dateSearchGameList">
<option value="" selected="selected">請選擇日期</option>
<option value="2016/08/13 (六)">2016/08/13 (六)</option>
<option value="2016/08/14 (日)">2016/08/14 (日)</option>
</select>
<input placeholder="請輸入搜尋關鍵字" type="text" name="keySearchGameList" id="keySearchGameList" />
<div id="gameList" class="grid-view">
<table class="normal">
<thead>
<tr>
@zlargon
zlargon / google-tts-example.js
Last active June 29, 2016 11:29
Node.js Google Text-To-Speech API Hacking
var googleTTS = require('./google-tts');
var opts = {
text: 'hello world',
lang: 'en',
speed: 1,
timeout: 10000
};
googleTTS(opts, function (err, url) {
var voc = require('voc-cli');
/* voc
*
* @param {String} word
* @param {String} directory the location for download
* @param {String!} service
* @return Promise(audioPath: String)
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define S_LEN 2048
#define DIGIT_LEN 10
struct {
char c;
char * word;
<!DOCTYPE html>
<html>
<head>
<title>Github Flavored Markdown</title>
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css">
<style>
.markdown-body {
width: 980px;
margin: 20px auto;
padding: 45px;
@zlargon
zlargon / fetch-goo.gl.js
Created April 26, 2016 03:03
fetch short url of "goo.gl"
#!/usr/bin/env node
'use strict';
const fetch = require('node-fetch');
const exec = require('child_process').execSync;
const ptt_url = 'https://www.ptt.cc/bbs/NBA/M.1461627008.A.3D4.html';
fetch(ptt_url)
.then(res => {
if (res.status !== 200) {
throw new Error(`request to ${ptt_url} failed, status code = ${res.status} (${res.statusText})`);
<!DOCTYPE html>
<html lang="en">
<head>
<title>Gist HTML Preview</title>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta http-equiv='Content-Type' content='text/html; charset=utf8'/>
<meta name='apple-mobile-web-app-capable' content='yes'/>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<style type="text/css">
<!DOCTYPE html>
<html>
<body>
<h2>test</h2>
<audio controls>
<source src="http://translate.google.com/translate_tts?ie=utf-8&client=tw-ob&q=test&tl=en-gb" type="audio/mpeg">
Your browser does not support the audio element.
</audio>