Skip to content

Instantly share code, notes, and snippets.

View takke's full-sized avatar

TAKEUCHI Hiroaki takke

View GitHub Profile
@takke
takke / MyAlertDialog.java
Created April 26, 2015 05:03
AlertDialogのクソラッパー
package jp.takke.ui;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
@takke
takke / EmojiFormatter.cs
Last active March 4, 2016 07:25
Tweenの絵文字表示対応のための部品:emojiSet だけ twemoji2.0 に対応させた版
// Copyright (c) 2015 takke (@takke) <http://takke.jp/>
// All rights reserved.
//
// LICENSE is NYSL (http://www.kmonos.net/nysl/)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@takke
takke / gist:89a50ba249289e5d7491
Last active August 29, 2015 14:06
replaceHashtagMentions
/**
* ハッシュタグやメンションを置換する
*
* @param html
* @param targets
* @return
*/
private static String replaceHashtagMentions(String html, final ArrayList<HashtagMentionEntity> targets) {
// 先に出てくる順にソート
takke@tm-nuc:~$ twurl "/1.1/statuses/show.json?id=479307198901026816" | php -R 'print_r(json_decode($argn));'
stdClass Object
(
[created_at] => Wed Jun 18 16:58:35 +0000 2014
[id] => 479307198901026816
[id_str] => 479307198901026816
[text] => Starting today, you can share and view animated GIFs on http://t.co/wJD8Fp317i, Android and iPhone. http://t.co/XBrAbOm4Ya
[source] => <a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>
[truncated] =>
[in_reply_to_status_id] =>
@takke
takke / gist:e6fd95542c6d3ea913e5
Last active August 29, 2015 14:02
extended_entities
takke@tm-nuc:~$ twurl "/1.1/statuses/show.json?id=449660889793581056" | php -R 'print_r(json_decode($argn));'
stdClass Object
(
[created_at] => Fri Mar 28 21:34:45 +0000 2014
[id] => 449660889793581056
[id_str] => 449660889793581056
[text] => "I hope you'll keep...building bonds of friendship that will enrich your lives &amp; enrich our world" ―FLOTUS in China, http://t.co/fxmuQN9JL9
[source] => <a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>
[truncated] =>
[in_reply_to_status_id] =>
@takke
takke / gist:8297439
Created January 7, 2014 10:20
ShowStatusをもとに作ったSPDY動作検証&ベンチマーク用のサンプル
/*
* Copyright 2007 Yusuke Yamamoto
*
* 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
@takke
takke / gist:8143276
Last active January 1, 2016 12:18
benchmark
// kick parallel (for benchmark)
class Box {
long total = 0;
int child = 0;
}
final Box box = new Box();
final int childCount = 10;
for (int i=0; i<childCount; i++) {
@takke
takke / gist:7990339
Last active December 31, 2015 12:59
Twitter4J v3.0.5でDM添付画像を取得してみた
// DM画像認証対応
MyLog.d("doDownloadImage, download image with twitter4j");
final Twitter twitter = TPUtil.getTwitterInstance(context);
try {
final Class<? extends Twitter> c = twitter.getClass();
final Method m = c.getDeclaredMethod("get", String.class);
m.setAccessible(true);
final HttpResponse res = (HttpResponse) m.invoke(twitter, rawImageUrl); // twitter.get(rawImageUrl);
@takke
takke / gist:7337833
Created November 6, 2013 15:22
twiccaプラグイン設定とかなんとか
@SuppressWarnings("deprecation")
protected void showTwiccaPluginConfig() {
// twicca 対応アプリ一覧探索
final PackageManager pm = getPackageManager();
final Intent intent = new Intent("jp.r246.twicca.ACTION_PLUGIN_SETTINGS");
final List<ResolveInfo> resolveInfo = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (resolveInfo.size() == 0) {
Toast.makeText(this, R.string.twicca_plugin_not_found, Toast.LENGTH_SHORT).show();