Skip to content

Instantly share code, notes, and snippets.

@azu
azu / e4xToDOM.js
Created February 21, 2010 08:24 — forked from gifnksm/e4xToDOM.js
e4xToDOM
// XML (E4X)からDOM Nodeへの変換
function e4xToDOM(xml, xmlns) {
// DTD 無指定の場合
if(!xmlns) xmlns = "http://www.w3.org/1999/xhtml";
var pretty = XML.prettyPrinting;
// 余分な空白を混入させないように,prettyPrintingを一時的に無効にする
XML.prettyPrinting = false;
var doc = (new DOMParser).parseFromString(
'<root xmlns="' + xmlns + '">' + xml.toXMLString() + "</root>",
@azu
azu / gist:403465
Created May 17, 2010 06:33 — forked from os0x/gist:360183
(function(){
// ある関数について、最初に呼び出されたときと2回目以降で処理を分ける方法
// 自分自身を書き換える関数
// 初期化コストが低いが、見た目がイマイチ
// 関数宣言でなくても良いが、関数宣言なら定義する場所を気にしなくて良くなる
function A(){
A = _A;
/*一回目の処理*/
// _A.apply(this,arguments);//2回目の処理を呼ぶこともOK
// ==UserScript==
// @name Twitter OAuth Caution
// @namespace http://github.com/mooz/
// @description Display caution when application requests a 'write' access
// @include http://twitter.com/oauth/authorize?*
// @include http://twitter.com/oauth/authenticate?*
// @include https://twitter.com/oauth/authorize?*
// @include https://twitter.com/oauth/authenticate?*
// ==/UserScript==
@azu
azu / wedata.js
Created June 11, 2010 12:06 — forked from youpy/gist:34615
// wedata utility for Greasemonkey
// usage
/*
var DATABASE_URL = 'http://wedata.net/databases/XXX/items.json';
var database = new Wedata.Database(DATABASE_URL);
database.get(function(items) {
items.forEach(function(item) {
// do something
});
});
// ==UserScript==
// @name A smart dashboard have my id
// @namespace jp.mitukiii.tumblr
// @include http*://www.tumblr.com/dashboard*
// ==/UserScript==
(function() {
var getMyId = document.getElementsByName("t")[0].value;
var isPost = function(elem) {
return !!elem.id.match(/^post[0-9]+$/i);
// ==UserScript==
// @name expand_twitter_notation
// @description はてなダイアリー編集中にtwitter記法を展開する
// @namespace http://shiba-yu36.net/
// @include http://d.hatena.ne.jp/*
// ==/UserScript==
(function() {
function parseTweetId (string) {
// ==UserScript==
// @name twicli post canceler
// @namespace http://efcl.info/
// @description twicliのポストを行うのに5秒の猶予を設けて、その間にキャンセルボタンを押せばポストをキャンセルできます。
// @author azu
// @homepage http://efcl.info/
// @twitter https://twitter.com/azu_re
// ==/UserScript==
/* http://gist.github.com/567983.txt をプラグインにロード */
@azu
azu / dispatcher.js
Created December 19, 2010 14:50 — forked from yoko/dispatcher.js
dispatcher.js
var dispatcher = {
location: window.location,
stash : [],
connect: function(paths, action) {
if (paths || paths === 0) {
paths = paths.valueOf();
if (!(typeof paths == 'object' && !(paths instanceof RegExp))) // webkit: typeof RegExp == 'function'
paths = { pathname: paths };
dispatcher.stash.push([paths, action]);
var embedReply, tweetCache = {};
(function () {
// APIが足りない時用proxy(気休め)
var proxies = [
{
url: twitterAPI + 'statuses/show/{id}.json?suppress_response_codes=true',
filter: function (d) {
return d
}
@azu
azu / togetterfilter.user.js
Created February 2, 2011 13:07 — forked from otsune/togetterfilter.user.js
Togetterをフィルタリング、GUIで設定可能
// ==UserScript==
// @name TogetterFilter
// @namespace TogetterFilter
// @description Togetterを任意のユーザー名を用いてフィルタリング
// @include http://togetter.com/*
// @require https://github.com/azu/usconfig/raw/v1.13/usconfig.js
// ==/UserScript==
// 設定画面の定義 - http://d.hatena.ne.jp/h1mesuke/20100713/p1
Config.define('usc_basic', function() {
with (this.builder) {