Skip to content

Instantly share code, notes, and snippets.

View henrytao-me's full-sized avatar

Henry Tao henrytao-me

View GitHub Profile
@henrytao-me
henrytao-me / gist:473c80a6383dc475356a
Last active August 29, 2015 14:16
AppScript sample
#!/bin/bash
osascript <<- APPLESCRIPT
##############################################
# utilities
##############################################
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
@henrytao-me
henrytao-me / RecycleEmptyErrorView.java
Last active December 13, 2016 15:42
Empty and Error in RecycleView
/*
* Copyright 2015 "Henry Tao <hi@henrytao.me>"
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@henrytao-me
henrytao-me / RxSharedPreferences
Created June 19, 2015 10:52
RxSharedPreferences
/*
* Copyright 2015 "Henry Tao <hi@henrytao.me>"
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@henrytao-me
henrytao-me / AndroidManifest.xml
Last active October 12, 2015 03:38
branch.io implementation
<meta-data
android:name="io.branch.sdk.TestMode"
android:value="true" />
<meta-data
android:name="io.branch.sdk.BranchKey.test"
android:value="key_test_..." />
<meta-data
android:name="io.branch.sdk.BranchKey"
android:value="key_live_..." />
public class BranchUtils {
public static final String BRANCH_KEY_ANDROID_DEEPVIEW = "$android_deepview";
public static final String BRANCH_KEY_CLICKED_BRANCH_LINK = "+clicked_branch_link";
public static final String BRANCH_KEY_OG_DESCRIPTION = "$og_description";
public static final String BRANCH_KEY_OG_IMAGE_URL = "$og_image_url";
/**
* Copyright 2013 Bo Wang
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@henrytao-me
henrytao-me / decompile_apk.md
Last active December 14, 2015 01:43
Decompile APK
@henrytao-me
henrytao-me / ghost-by-tag-helper.js
Created December 31, 2015 09:31
ByTag helper for ghost blogging platform
var hbs = require('express-hbs'),
api = require('./core/server/api'),
_ = require('lodash'),
async = require('express-hbs/lib/async'), // To redefine `registerAsyncHelper`
registerAsyncHelper;
// Redefine `registerAsyncHelper` from `express-hbs`
registerAsyncHelper = function(name, fn) {
hbs.handlebars.registerHelper(name, function(context, options) {
// Pass `[context, options]` as arg instead of `context` only
/*
* Copyright 2016 "Henry Tao <hi@henrytao.me>"
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software