Skip to content

Instantly share code, notes, and snippets.

View yuya's full-sized avatar

Yuya Hashimoto yuya

View GitHub Profile
@yuya
yuya / gist:8497370df8380b1a1f6a
Created August 21, 2014 08:30
GoogleConversionTrackingBridge.java
/*
* GoogleConversionTrackingBridge.java
* Copyright (C) 2014 Yuya Hashimoto
*/
package im.yuya.unitygoogleconversiontrackingplugin;
import com.unity3d.player.UnityPlayer;
import android.app.Activity;
import java.util.Map;
@yuya
yuya / lolcommits_to_gif_animation.sh
Created June 18, 2014 18:39
1日以内の lolcommits 画像を GIF アニ化する Shell script
#!/bin/sh
cd ~/.lolcommits && rm -rf tmp && mkdir tmp && find . -name "*.jpg" -mtime -1 -print0 | xargs -0 -J % cp % tmp && convert -delay 15 tmp/*.jpg ani.gif && rm -rf tmp
unless Function::bind
Function::bind = (obj) ->
unless typeof this is "function"
throw new TypeError "Function.prototype.bind - what is trying to be bound is not callable"
slice = [].slice
args = slice.call(arguments, 1)
method = this
noop = ->
bound = ->
@yuya
yuya / coffee2json
Last active August 29, 2015 14:01
Coffee Script to JSON
#!/bin/sh
if ! type coffee > /dev/null 2>&1; then echo "Please install the coffee-script."; exit; fi
if [[ ! "${1}" =~ \.coffee$ ]]; then echo "File extension error"; exit; fi
echo \{
cat $1 | \
coffee --print --bare --compile --stdio | \
sed -e '1,2d; $d' | \
sed "s/\([^ '\"].*[^ '\"]\): /\"\1\": /"
@yuya
yuya / AndroidManifest.xml
Created May 22, 2014 10:18
Development Player Android Manifest file (Unity 4.3.4)
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
android:installLocation="preferExternal"
android:theme="@android:style/Theme.NoTitleBar"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
<table>
<tbody><tr>
<th> feature/os version</th>
<th><a class="keyword" href="http://d.hatena.ne.jp/keyword/ios">ios</a>-4.3.2</th>
<th><a class="keyword" href="http://d.hatena.ne.jp/keyword/ios">ios</a>-5.0</th>
<th><a class="keyword" href="http://d.hatena.ne.jp/keyword/ios">ios</a>-5.1</th>
<th><a class="keyword" href="http://d.hatena.ne.jp/keyword/ios">ios</a>-6.0</th>
<th><a class="keyword" href="http://d.hatena.ne.jp/keyword/android">android</a>-1.6</th>
<th><a class="keyword" href="http://d.hatena.ne.jp/keyword/android">android</a>-2.1</th>
<th><a class="keyword" href="http://d.hatena.ne.jp/keyword/android">android</a>-2.3.3</th>
@yuya
yuya / gist:38e5cbb4adb2e7a7dd78
Created May 15, 2014 02:25
Transparent 1px GIF of base64 binary
data:image/gif;base64,R0lGODlhAQABAHAAACH5BAUHAAAALAAAAAABAAEAQAICRAEAOw==
@yuya
yuya / Code.gs
Last active January 4, 2016 18:59
Google Apps Script で簡易 Base64Encoder
function getImageBase64(source) {
var image = UrlFetchApp.fetch(source),
blob, contentType, base64;
if (!image) {
return;
}
blob = image.getBlob();
contentType = blob.getContentType();
var API = {
UPDATE_WITH_MEDIA : "https://api.twitter.com/1.1/statuses/update_with_media.json"
};
function oAuthConfig() {
var oAuthConfig = UrlFetchApp.addOAuthService("twitter");
oAuthConfig.setAccessTokenUrl("https://api.twitter.com/oauth/access_token");
oAuthConfig.setRequestTokenUrl("https://api.twitter.com/oauth/request_token");
oAuthConfig.setAuthorizationUrl("https://api.twitter.com/oauth/authorize");
// Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed
(function () {
var cache = {};
this.tmpl = function tmpl(str, data) {
var fn = !/\W/.test(str) ?
cache[str] = cache[str] ||
tmpl(document.getElementById(str).innerHTML) :