Skip to content

Instantly share code, notes, and snippets.

/*
* for Ubiquity 0.5
*/
CmdUtils.CreateCommand({
names: ["alc"],
icon: "http://www.alc.co.jp/favicon.ico",
homepage: "http://d.hatena.ne.jp/bellbind/",
author: {name: "bellbind", email: "bellbind@gmail.com"},
license: "GPL",
description: [
// ==UserScript==
// @name pixiv remove user
// @namespace http://d.hatena.ne.jp/monjudoh/
// @include http://www.pixiv.net/member.php?id=*
// @require http://dl.dropbox.com/u/612874/jquery-1.4.2_patch_applied_for_GM.js
// ==/UserScript==
(function(){
$('<div/>',{
html : $('<a/>',{
// ==UserScript==
// @name newmouse
// @namespace http://www.hatena.ne.jp/hitode909
// @include *
// ==UserScript==
var Nears = function(x, y) {
this.centerX = x;
this.centerY = y;
this.i = 0;
use JSTAPd::Suite;
sub tests { 11 }
sub include {
(
# /Users/monjudoh/Sites/callendar-demo/js/config-require.js
'/js/config-require.js',
'/js/allplugins-require.js',
);
}
@monjudoh
monjudoh / gist:765881
Created January 5, 2011 03:17
IE(主に6,7)で「操作は中断されました」エラーが出るヶ所でstackTraceをalertで出す。これに依存→ https://github.com/emwendelin/javascript-stacktrace
(function(){
var domManip = jQuery.fn.domManip;
jQuery.fn.domManip = function(){
if(!jQuery.isReady && !!this.closest('body').size() ) {
var msg = printStackTrace().join('\n');
alert(msg);
throw new Error();
}
return domManip.apply(this,arguments);
}
@monjudoh
monjudoh / underscore.interval-iterator.js
Created February 7, 2011 07:54
長時間かかる反復メソッド(each,map,reduce等)の実行をtimerで飛ばしながら休み休み行うUnderscore.js用mixin
/*
* Underscore.js plugin
* http://documentcloud.github.com/underscore/
*/
(function(){
var root = this;
var console = root.console;
var optionsTable = {};
var setResultTable = {};
var lib = {};
@monjudoh
monjudoh / gist:909813
Created April 8, 2011 13:20
JavaScriptのobject・arrayからObjective-CのNSDictionary,NSArrayのコード生成
function stringToNSString(str) {
return ['@"',str,'"'].join('');
}
function numberToNSNumber(num) {
return ['[NSNumber numberWithLong:',num,']'].join('');
}
function booleanToNSNumber(bool) {
return ['[NSNumber numberWithBool:',(bool ? 'YES' : 'NO'),']'].join('');
}
@monjudoh
monjudoh / canvas.html
Created December 12, 2011 07:38 — forked from moriyoshi/canvas.html
canvas
<html>
<body>
<canvas id="test" width="320" height="320"></canvas>
<script type="text/javascript">
(function() {
var proto = document.createElement('canvas').getContext('2d').constructor.prototype;
var x = proto.fillText;
proto.fillText = function fillText(text) {
if (proto.fillText !== fillText) {
proto.fillText = fillText;
@monjudoh
monjudoh / fizzbuzz.js
Created August 7, 2012 05:28
FizzBuzzを久々に素直に書いたら長くなった
Array.apply(null,new Array(101))
.map(function(n,i){ return '';})
.map(function(n,i){ return n+(i % 3 ? '' : 'Fizz');})
.map(function(n,i){ return n+(i % 5 ? '' : 'Buzz');})
.map(function(n,i){ return n ? n : i;})
.slice(1,101)
@monjudoh
monjudoh / gist:3303195
Created August 9, 2012 10:44
JSでFizzBuzz。剰余と一切の条件分岐を無くしたよ。さらに、元々ループと再帰はなかったけど、反復メソッドも(見かけ上)なくしたよ。
fizzArray = [];
buzzArray = [];
new Array(101).join('a').replace(/a/g,function(n,i){
fizzArray = fizzArray.concat(['','','Fizz']);
buzzArray = buzzArray.concat(['','','','','Buzz']);
var result = (fizzArray[i]+buzzArray[i]).replace(/^$/,i + 1);
return result + '\n';
});