Skip to content

Instantly share code, notes, and snippets.

View tmyt's full-sized avatar
🏠
Working from home

Yutaka TSUMORI tmyt

🏠
Working from home
View GitHub Profile
@tmyt
tmyt / gist:737330
Created December 11, 2010 11:40
Bubobo (require VisualC++)
#include<string>
#include<iostream>
#include<stack>
int main()
{
std::string s;
while(std::getline(std::cin, s))
{
for each(char c in s)
@tmyt
tmyt / gist:751083
Created December 22, 2010 04:12
AzureaScriptExtension Sample - QuotedReply
function quotedReply(id)
{
var status = TwitterService.status.get(id);
var text = "QT @" + status.user.screen_name + ": " + status.text;
TextArea.text = text;
TextArea.in_reply_to_status_id = status.id;
TextArea.show();
TextArea.setFocus();
TextArea.setCursor(0);
}
@tmyt
tmyt / gist:751596
Created December 22, 2010 14:44
Azurea ScriptExtention Sample - OpenFavstar
/*
コンテキストメニューに選択されたTweetの送信者の
Favstarを開くコマンドを追加する拡張
同じ機能をShift+Fにも割り当てる。
*/
function openFavstar(id)
{
var status = TwitterService.status.get(id);
System.openUrl('http://favstar.fm/users/' + status.user.screen_name + '/recent');
}
@tmyt
tmyt / gist:752740
Created December 23, 2010 08:32
Azurea Script Sample
/*
Twitのようなショートカットキーを拡張スクリプトで実装してみる。
H,Oには組み込みのショートカットが実装されてるけども、
スクリプト側で上書きしたのが優先される。
*/
// Hキーでユーザをブラウザで表示する
System.addKeyBindingHandler('H'.charCodeAt(0), 0, function(id){
var s = TwitterService.status.get(id);
System.openUrl('http://twitter.com/' + s.user.screen_name);
});
@tmyt
tmyt / gist:756337
Created December 27, 2010 17:39
Azurea Script Sample (Require 1.3.2 Beta4 lator)
/*
Beta4で追加されたHTTP Post APIを使って診断メーカーをアプリないで解決してみるスクリプト。
*/
System.addContextMenuHandler('診断メーカー', 0, function(id){
var status = TwitterService.status.get(id);
var curUsr = TwitterService.currentUser();
if(status.text.match('http://shindanmaker.com/[0-9]+')){
var resp = Http.postRequest(RegExp.lastMatch, "u="+encodeURI(curUsr.screen_name), false);
resp.body.match('<textarea.*?>(.*?)</textarea>');
TextArea.text = RegExp.$1;
@tmyt
tmyt / gist:767731
Created January 6, 2011 10:14
Azurea Script Sample
/*
選択されたユーザのホームからPost数を探してきて表示してみる
*/
System.addContextMenuHandler('Get tweets count', 0, function(id){
var st = TwitterService.status.get(id);
var html = Http.downloadString("http://twitter.com/" + st.user.screen_name);
if(html.match('<span id="update_count" class="stat_count">([0-9,]+)</span>')){
System.showNotice("@" + st.user.screen_name + "'s total tweets: " + RegExp.$1);
}
});
@tmyt
tmyt / gist:768160
Created January 6, 2011 17:00
Azurea Script Sample
/*
選択されたユーザのホームからPost数を探してきて表示してみる API版(Require API Level:5-)
*/
System.addContextMenuHandler('Get tweets count', 0, function(id){
var st = TwitterService.status.get(id);
var xml = TwitterService.call('/users/show/' + st.user.screen_name + '.xml');
if(xml.match('<statuses_count>(\\d+)</statuses_count>')){
System.showNotice("@" + st.user.screen_name + "'s total tweets: " + RegExp.$1);
}
});
@tmyt
tmyt / gist:802965
Created January 30, 2011 15:58
Azurea Script Sample
/*
Postの中で最初に出現するURLをブラウザで開くショートカットキーをつくってみた。
.キーで実行されまする。
API Level >= 8 な環境で使ってね!
*/
System.addKeyBindingHandler(0xBE, 0, function(id){
var urls = new Array();
TwitterService.status.getUrls(id, urls);
if(urls.length > 0) System.openUrl(urls[0]);
});
System.addContextMenuHandler('mention',0,function(id){if(id!='0'){var s=TwitterService.status.get(id);TextArea.text='@'+s.user.screen_name;TextArea.show();TextArea.setFocus();});
@tmyt
tmyt / gist:831901
Created February 17, 2011 15:15
Azurea Script Sample
/*
診断メーカーする拡張(https://gist.github.com/756337)の非同期版。
Require: API Level >= 9
*/
System.addContextMenuHandler('診断メーカー', 0, function(id){
var status = TwitterService.status.get(id);
var curUsr = TwitterService.currentUser();
if(status.text.match('http://shindanmaker.com/[0-9]+')){
Http.postRequestAsync(RegExp.lastMatch, "u="+encodeURI(curUsr.screen_name), false, function(resp){
resp.body.match('<textarea.*?>(.*?)</textarea>');