Skip to content

Instantly share code, notes, and snippets.

@teramako
teramako / iterator.js
Created July 29, 2010 13:25
なんでもGeneratorに変換して、統一したインターフェースで回すためのライブラリ
/**
* なんでもGeneratorに変換して、統一したインターフェースで回すためのライブラリ
*
* 対応リスト
* - Array
* - String
* - NodeList
* - HTMLCollection
* - nsISupportsArray
* - nsIEnumerator
@teramako
teramako / log-writer.tw
Created August 5, 2010 18:20
twittperatorのChirpUserStreamからのデータをログに書き出す
/*
* このファイルを置いたディレクトリに
* twittperator.log
* を作って、ChirpUserStream からのデータを書き出すよ
* tail -f で見ると良い感じ!!
*/
let charset = "UTF-8";
let os, fos;
@teramako
teramako / twlist.tw
Created August 7, 2010 20:22
Vimperatorのtwittperator.js用
/*
g:twlist_screen_name = <your screen name>
== Options ==
set [no]showtwlist[!]
show twittperator timeline
*/
XML.ignoreProcessingInstructions = false;
let xml = <>
<?xml-stylesheet type="text/css" href="chrome://browser/skin/"?>
<window id="twitt-popup"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
pack="start"
ondblclick="window.close()">
<box id="dialog" style="padding: 10px; border: 2px solid #7B969C;">
<hbox align="center" pack="center">
js <<EOM
let windowListener = {
titles: {
"chrome://mozapps/content/downloads/downloads.xul": "Download Window Title",
},
observe: function(s, t, d) {
if (t=="domwindowopened" && s=="[object ChromeWindow]"){
s.QueryInterface(Ci.nsIDOMWindow);
let self = this;
s.addEventListener("DOMContentLoaded", function(){
@teramako
teramako / linkLarger.user.js
Created October 4, 2010 12:48
Firefox 4以上が対象。リンクが多いとハング歯科寝ないので注意
// ==UserScript==
// @name linkLarger
// @namespace http://gist.github.com/teramako/
// @description リンクを大きくするお!! 【注意】超重たい
// @include http://*
// ==/UserScript==
const C = "linkLarger-link";
GM_addStyle(<><![CDATA[
.linkLarger-link {
@teramako
teramako / htmlParser.js
Created November 1, 2010 13:22
iframeにテキストを読み込ませてHTMLパースを行う
/**
* HTML テキストをパースするサンプル
* @see http://mxr.mozilla.org/mozilla/source/browser/components/microsummaries/src/nsMicrosummaryService.js
*
* スクリプトや画像を読み込まず、パースのみをするはず。
* 当然ながら XPCOM の使用特権(Chrome特権)が必要
*/
/*
// Sample 1
httpGet("http://example.com",
@teramako
teramako / fork_and_exec_vim.pl
Created November 12, 2010 15:21
プログラム内でエディターを起動して、終了後そのファイルを読むサンプル
#!/bin/perl -lw
use strict;
use warnings;
my $pid = fork;
my $tmpfile = "/tmp/hoge.tmp";
die "Connot fork: $!" unless defined $pid;
@teramako
teramako / exntend_array.js
Created November 16, 2010 13:06
JavaScript あるオブジェクトをArrayで拡張する正しい方法求む
function EXArray () {
for (var i = 0, len = arguments.length; i < len; i++) {
this[i] = arguments[i];
}
this.__proto__.__proto__ = Array.prototype.slice.call(arguments);
}
EXArray.prototype = {
item: function (i) {
return this[i];
@teramako
teramako / panorama_bg.css
Created November 29, 2010 05:11
Change background-image of Panorama for Firefox 4.0
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");
@-moz-document url("chrome://browser/content/tabview.html") {
html|div#bg {
background-image: url(file:///C:/........./panorama_bg.jpg) !important;
background-size:100% auto !important;
background-position:0 0 !important;
}
}