Skip to content

Instantly share code, notes, and snippets.

View javascripter's full-sized avatar

javascripter

View GitHub Profile
#!/usr/bin/env ruby
require "rubygems"
require "mechanize"
URL = "http://stage.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-central-macosx/"
FILE_NAME = "latest_firefox.dmg"
agent = WWW::Mechanize.new
agent.get(URL).links.reverse.find {|link| %r(^¥d+/$) =~ link.text }.click.links.last.click.save_as(FILE_NAME)
puts "attach"
`hdiutil attach #{ FILE_NAME }`
// ==UserScript==
// @name FixAAFont
// @namespace http://d.hatena.ne.jp/javascripter/
// @include http*
// ==/UserScript==
var xpr = document.evaluate('descendant-or-self::*[contains(text(), "/")]/ancestor-or-self::div', document.body, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < xpr.snapshotLength; ++i) {
var elem = xpr.snapshotItem(i);
var prefix = elem.className ? ' ' : '';
#!/usr/bin/ruby
require "rubygems"
require "uuidtools"
require "erb"
require "webrick/cgi"
class CGI < WEBrick::CGI
include ERB::Util
def do_GET(req, res)
// ==UserScript==
// @name YouTubeAutoHDQuality
// @namespace http://d.hatena.ne.jp/javascripter/
// @include http://jp.youtube.com/*
// ==/UserScript==
// -> http://google-mania.net/archives/1110
// location.href = 'javascript:void changeVideoQuality(yt.VideoQualityConstants.HIGH);';
// ==UserScript==
// @name dict
// @namespace http://d.hatena.ne.jp/javascripter/
// @include http://*
// @resource script http://chasen.org/~taku/software/TinySegmenter/tiny_segmenter-0.1.js
// ==/UserScript==
// Ctrl+Shift+D, Mac only
var script = document.createElement('script');
if (typeof document.setUserData !== 'function') {
Node.prototype.setUserData = function (key, data, handler) {
var value = this.getUserData(key);
if (handler !== null) throw new Error('The handler argument is not supported');
if (data === null) {
delete this.__userData[key];
} else {
this.__userData[key] = data;
}
return value;
@charset "UTF-8";
h1 { font-size: 1.5em; }
h2 { font-size: 1.3em; }
h3 { font-size: 1.1em; }
pre { white-space: pre-wrap; }
@namespace url(http://www.w3.org/1999/xhtml);
@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
html, div, map, dt, isindex, form, body, p, dl, multicol, dd, blockquote, address, center, span, pre, h1, h2, h3, h4, h5, h6, listing, xmp, pre, plaintext, table, caption, tr, col, colgroup, tbody, thread, tfoot, td, th, form, q, b, i, tt, u, ins, s, strike, del, blink, big, small, sub, sup, nobr, abbr, acronym, ul, menu, dir, ol, li, hr, img, applet, object, embed, frameset, frame, iframe, noframes, spacer, canvas, base, big, br, center, cite, code, col, colgroup, dfn, em, fieldset, font, kbd, label, legend, link, samp, small, span, strike, strong, var, area, basefont, head, meta, script, style, title, video, audio, marquee {
font: -moz-initial !important;
background: -moz-initial !important;
padding: -moz-initial !important;
margin: -moz-initial !important;
border-bottom-color: -moz-initial !important;
border-bottom-style: -moz-initial !important;
function getElementById(id, context) { // context free
if (!context) context = document;
if (context instanceof HTMLDocument) return context.getElementById(id);
return context.ownerDocument.evaluate(
'id("' + id + '")',
context,
null,
XPathResult.FIRST_ORDERED_NODE_TYPE,
null
).singleNodeValue;
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="x">
<implementation><constructor><![CDATA[
alert(1);
]]></constructor></implementation>
</binding>
</bindings>