Skip to content

Instantly share code, notes, and snippets.

@mgng
mgng / gist:57545
Created February 3, 2009 14:33
リラックマごゆるり検索をFirefoxに組み込む
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<Url type="application/x-suggestions+json" method="GET" template="http://api.search.yahoo.co.jp/AssistSearchService/V2/webassistSearch">
<Param name="p" value="{searchTerms}"/>
<Param name="output" value="fxjson"/>
<Param name="ei" value="utf-8"/>
</Url>
<InputEncoding>UTF-8</InputEncoding>
<OutputEncoding>UTF-8</OutputEncoding>
<Url type="text/html" template="http://search.san-x.co.jp/search/?Keywords={searchTerms}"/>
@mgng
mgng / gist:91156
Created April 7, 2009 09:13
Google翻訳APIで選択文字列を翻訳する
function trs(){
google.load('language','1',{'callback':function(){
var d=document,w=window,b=d.createElement('input');
b.type='button';
b.value='translate';
b.style.zIndex=99;
b.style.position='fixed';
b.style.top=0;
b.style.left='50%';
b.style.display='block';
@mgng
mgng / gist:91281
Created April 7, 2009 15:12
tube8 flv download javascript
document.body.innerHTML='<a href="'+videourl+'">DL</a>'
@mgng
mgng / gist:91624
Created April 8, 2009 04:13
Google翻訳APIを使った選択文字列翻訳ブックマークレット(英→日)
function _trsen_(){
google.load('language','1',{'callback':function(){
var d=document,w=window,b=d.createElement('input');
b.type='button';
b.value='英→日翻訳';
b.style.zIndex=99;
b.style.position='fixed';
b.style.top=0;
b.style.left='50%';
b.style.display='block';
@mgng
mgng / gist:95532
Created April 15, 2009 01:17
Google翻訳APIを使った選択文字列翻訳ブックマークレット(日→英)
function _trsja_(){
google.load('language','1',{'callback':function(){
var d=document,w=window,b=d.createElement('input');
b.type='button';
b.value='日→英翻訳';
b.style.zIndex=99;
b.style.position='fixed';
b.style.top='2em';
b.style.left='50%';
b.style.display='block';
@mgng
mgng / gist:108706
Created May 8, 2009 08:05
簡易計測
<?php
// 簡易計測クラス
class Keisoku
{
private static $_m = 0;
private static $_t = 0;
public static function start(){
self::$_t = microtime(true);
self::$_m = memory_get_usage(true);
}
@mgng
mgng / gist:115508
Created May 21, 2009 15:09
AAをランダムに表示するやつ
<?php
// http://taggedaa.com/ からランダムに何かを表示するやつ
// コマンドラインで実行
// http://taggedaa.com/asciiart.php?id=92
$baseUrl = 'http://taggedaa.com/asciiart.php?id=';
$num = rand(1,400);
$url = $baseUrl.$num;
$src = file_get_contents($url);
@mgng
mgng / gist:127802
Created June 11, 2009 09:27
正n角形を描画するテスト
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="content-style-type" content="text/css">
<title>正n角形を描画するテスト</title>
</head>
<body>
<style type="text/css"><!--
@mgng
mgng / gist:132408
Created June 19, 2009 04:22
ラーメンタイマー
(function(){var i=180,b=document.body,s=setInterval,c=clearInterval,t=s(function(){b.innerHTML=i;if(i--<1){c(t);t=s(function(){b.style.background=(i=i?0:1)?'red':'blue'},99)}},1000)})()
@mgng
mgng / gist:136360
Created June 26, 2009 07:51
メールアドレスを1ドットタグで書くソリューション
function _dotmail_(mail_addr, elm_id, bgcolor, color) {
var str_list={
a:[[1,3],[2,3],[3,4],[3,5],[3,6],[2,6],[1,5]],
b:[[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[2,3],[3,3],[4,4],[4,5],[3,6],[2,6]],
c:[[3,3],[2,3],[1,4],[1,5],[2,6],[3,6]],
d:[[3,3],[2,3],[1,4],[1,5],[2,6],[3,6],[4,6],[4,5],[4,4],[4,3],[4,2],[4,1]],
e:[[1,5],[1,6],[2,7],[3,7],[2,4],[3,5]],
f:[[2,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7],[2,3],],
g:[[1,4],[1,5],[2,6],[3,6],[2,3],[3,3],[4,3],[4,4],[4,5],[4,6],[4,7],[3,8],[2,8]],
h:[[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[2,4],[3,5],[3,6]],