Skip to content

Instantly share code, notes, and snippets.

var count = num = 1000;
var start = Date.now();
function proc(){
if(!--count){
console.log((Date.now() - start) / num);
return;
}
defer();
(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?
@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');
// 僕こうかな…けっこう一貫してないけど
// 先頭近辺での揃えのスペースがすごく少ないな
if ((
cond_a || cond_b ||
cond_c || cond_d) || cond_e) {
}
test(
value1, value2,
value3, value4);
@to
to / action.collectFileLinks.js
Created June 3, 2011 19:08
action.collectFileLinks.js
@to
to / google-removeTrackingListener.user.js
Created October 8, 2011 16:47
Google - Remove Tracking Listener
// ==UserScript==
// @id www.google.com-3ca00d86-e5af-4ad5-beca-fc6012a7500b@to.tumblr.com
// @name Google - Remove Tracking Listener
// @version 1.0
// @namespace to.tumblr.com
// @include http://www.google.com/search*
// @run-at window-load
// ==/UserScript==
setInterval(function process(){
@to
to / gist:1676724
Created January 25, 2012 15:15
throttleAndDebounce
Function.prototype.throttleAndDebounce = function(threshold, delay){
threshold = threshold || 100;
delay = delay || threshold;
var me = this;
var expire = 0;
var timeout;
return function(){
if(timeout)
clearTimeout(timeout);
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("twitter.com") {
div[data-component-term="user_recommendations"],
div[data-component-term="trends"],
div[data-component-term="footer"],
.fullname{
display: none !important;
}
var elmImage = document.createElement('img');
console.time('clone');
for(var i=0 ; i<100000 ; i++)
elmImage.cloneNode(false);
console.timeEnd('clone');
console.time('img');
for(var i=0 ; i<100000 ; i++)
document.createElement('img');
console.timeEnd('img');
@to
to / gist:2295332
Created April 3, 2012 20:40
Google Chrome 18 - svg & absolute bug
<!doctype html>
<html>
<head>
<style type="text/css">
.frame {
position: absolute;
width: 100px;
height: 100px;
}