Skip to content

Instantly share code, notes, and snippets.

@to
to / action.collectFileLinks.js
Created June 3, 2011 19:08
action.collectFileLinks.js
// 僕こうかな…けっこう一貫してないけど
// 先頭近辺での揃えのスペースがすごく少ないな
if ((
cond_a || cond_b ||
cond_c || cond_d) || cond_e) {
}
test(
value1, value2,
value3, value4);
@to
to / gist:888157
Created March 26, 2011 09:17
environment.greasemonkey.js
connect(grobal, 'environment-load', function(){
var gm = Cc['@greasemonkey.mozdev.org/greasemonkey-service;1'];
if(gm){
gm = gm.getService().wrappedJSObject;
addBefore(gm, 'evalInSandbox', function(){
for(var i=0, len=arguments.length ; i<len ; i++){
var arg = arguments[i];
if(typeof(arg) == 'object'){
arg.GM_addStyle = function(){
alert('patched');
(function(){
function hash(s){
return s.split('').join('\u200E');
}
QuickPostForm.descriptionContextMenus.push({
name : 'No Searchable',
execute : function(elmText, description){
var text = elmText.value.slice(elmText.selectionStart, elmText.selectionEnd);
text?
var count = num = 1000;
var start = Date.now();
function proc(){
if(!--count){
console.log((Date.now() - start) / num);
return;
}
defer();
@to
to / gist:748186
Created December 20, 2010 09:14
rbma.js
loadPolicies.push(function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra){
try{
var url = contentLocation.spec;
if(contentType == IContentPolicy.TYPE_DOCUMENT)
return false;
if(/\/safestream\.php/.test(url)){
if(url.match('rbmaradio.de'))
url = url.replace('rbmaradio.de', 'archive1.rbmastream.net');
addTab(url);
Tombloo.Service.actions.register({
name : 'BBモバイルポイントをコピーする',
type : 'context',
check : function(ctx){
return new RegExp('/bbmp.softbanktelecom.co.jp/cgi-bin/service/bbmobile_search/list_city.cgi\\?ac=').test(ctx.href);
},
execute : function(ctx){
// http://bbmp.softbanktelecom.co.jp/cgi-bin/service/bbmobile_search/list_city.cgi?ac=13
var self = this;
update(MochiKit.Style.Coordinates.prototype, {
equals : function(target){
return target && (this.x == target.x && this.y == target.y);
}
,
clone : function(){
return new Coordinates(this.x, this.y);
}
,
getDistance : function(pos){
// ==UserScript==
// @name YouTube Manual Play
// @include http://www.youtube.com/watch*
// @include http://youtube.com/watch*
// ==/UserScript==
(function(){
var player = document.getElementById('movie_player');
if(!player)
return;
// ==UserScript==
// @name Twitter Title Chop
// @include http://twitter.com/*
// ==/UserScript==
window.addEventListener('load', function(){
document.title = document.title.replace(/Twitter[ \/]*/, '');
}, true);