This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addCSS (css){ | |
if (document.createStyleSheet) { // for IE | |
var sheet = document.createStyleSheet(); | |
sheet.cssText = css; | |
return sheet; | |
} else { | |
var sheet = document.createElement('style'); | |
sheet.type = 'text/css'; | |
var _root = document.getElementsByTagName('head')[0] || document.documentElement; | |
sheet.textContent = css; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
#use warnings; | |
#use CGI::Carp qw(fatalsToBrowser); | |
use HTTP::Lite; | |
use CGI; | |
use JSON; | |
my $q = CGI->new; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reduce https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce#Compatibility | |
function reduce(arr, fun){ | |
var len = arr.length, i = 0; | |
if (arguments.length >= 3) { | |
var rv = arguments[2]; | |
} else { | |
do { | |
if (i in arr) { | |
rv = arr[i++]; | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// element.style.position='fixed'; | |
// endrag(element); | |
// e.g. http://ss-o.net/test/drag.html | |
// doesn't work in IE! | |
function endrag(element,opt){ | |
endrag = function(element,opt){ | |
return new endrag.proto(element,opt||{}); | |
} | |
endrag.proto = function(elem,opt){ | |
var self = this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function URI(uri,base){ | |
var a, _loc = location, self = this; | |
if (base) {//via nanto_vi | |
var XHTML_NS = "http://www.w3.org/1999/xhtml"; | |
var XML_NS = "http://www.w3.org/XML/1998/namespace"; | |
a = document.createElementNS(XHTML_NS, 'a'); | |
a.setAttributeNS(XML_NS, 'xml:base', base); | |
} else if (URI.cache) { | |
a = URI.cache; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name simple_guestures | |
// @namespace http://looxu.blogspot.com/ | |
// @description opera like mouse guesture for google chrome | |
// @author Gomita / Arc Cosine | |
// @version 1.1 | |
// ==/UserScript== | |
// This code is inspired by Gomita's Code | |
// Look => http://www.xuldev.org/misc/script/MouseGestures.uc.js | |
// license http://0-oo.net/pryn/MIT_license.txt (The MIT license) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- from:http://blog.hawklab.jp/item-62.html --> | |
<p>リンク元をチェックしていて気になった、『<a href="http://www.akatsukinishisu.net/itazuragaki/js/bindaseventlistener.html" target="_blank">bindとbindAsEventListenerについての疑問</a>』。</p> | |
<p>『<a target="_blank">prototype.js 1.4.0を読む:base.jsその2</a>』では「bindAsEventListenerはIEのためにある」と書いたが、IEでもattachEventを使えば、Eventオブジェクトが引数として与えられるので、bindAsEventListenerは要らないのではないか、という話。</p> | |
<div> | |
$('hoge').attachEvent('onclick', function(e) {<br/> | |
alert('引数の数は'+ arguments.length +'個');<br/> | |
<br/> | |
if(e != window.event) {<br/> | |
alert('同じオブジェクトではありません');<br/> | |
}<br/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name canvas.GlitchMonkey | |
// @namespace http://d.hatena.ne.jp/youpy/ | |
// @description corrompe las fotos de cualquier website | |
// @include * | |
// ==/UserScript== | |
(function(){ | |
var Corruptions = { | |
'image/jpeg': function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -wT | |
use strict; | |
print "Content-Type: text/plain\n"; | |
print "Access-Control-Allow-Origin: *\n\n"; | |
print "PASS: Cross-domain access allowed.\n"; |