Skip to content

Instantly share code, notes, and snippets.

View ww24's full-sized avatar
🏢
≡GO

Takenori Nakagawa ww24

🏢
≡GO
View GitHub Profile
@ww24
ww24 / uxnu-bookmarklet-script.js
Created June 26, 2011 03:55
ux.nu Bookmarklet
var uxnuURLShortener = function(j) {
var sc = j.status_code;
if (sc == 200) {
prompt('Short URL', j.data.url);
} else {
alert(sc+': '+j.description);
}
};
(function() {
var d = document;
@ww24
ww24 / bookmarklet.js
Created August 22, 2011 07:40
新Twitter用一斉返信ブックマークレット
javascript:(function(){var g=$("a.js-action-reply"),a="textarea.twitter-anywhere-tweet-box-editor",$t,n;for(var i=0,l=g.size();i<l;i++){t=g.eq(i);if(t.parent().find("a.js-action-replyAll").size()<1){n=t.data("screenName")||t.attr("data-screen-name");t.after('<a class="reply-action js-action-replyAll" href="#" title="一斉返信" data-screen-name="'+n+'" onclick="(function(){var t=$(\''+a+'\');t.val(\'@'+n+' \'+t.val())})();return false"><span><i></i><b>一斉返信</b></span></a>').data("screenName",n)}}})();
@ww24
ww24 / jquery.vslb.js
Created September 14, 2011 22:56
Very Simple LightBox
/*
* jquery.vslb.js
* とてもシンプルなLightBoxプラグイン
* Version : 0.1.1 rev1
* Copyright : ww24
* License : MIT License
*/
(function ($) {
var count = 0;
$.fn.vslb = function (options) {
@ww24
ww24 / create.html
Created November 7, 2011 14:53
Image Shortener
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" />
<title>Image Shortener</title>
</head>
<body>
<div id="wrapper">
<h1 class="title">URL短縮サービスを利用したオンラインストレージ</h1>
ww24@s4[~/node-v0.6.0]$ ./configure --prefix=~/local [8:19:36]
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc
Checking for gcc : ok
Checking for library dl : yes
Checking for openssl : yes
@ww24
ww24 / http.coffee
Created January 14, 2012 01:47
js2coffee http.js > http.coffee
http = require("http")
path = require("path")
url = require("url")
fs = require("fs")
configure = (settingsFile) ->
settings = JSON.parse(fs.readFileSync(settingsFile, "utf8"))
items = [ settings.host, settings.port ]
item = ""
points = []
point = ""
@ww24
ww24 / bookmarklet.js
Created January 16, 2012 12:41
YouTube getVideoURL Bookmarklet
javascript:(function(){if(typeof(yt)==="undefined"){alert("このページでは実行できません");return false}var v=yt.playerConfig.args.url_encoded_fmt_stream_map.split(","),d=document,b=d.getElementsByTagName("body")[0],u=d.createElement("ul"),a,i;u.style["list-style-type"]="decimal";u.style.padding="10px 20px";u=b.insertBefore(u,b.firstChild);for(i=0;v.length>i;i++){v[i]=decodeURIComponent(v[i].split("url=")[1]).split("&type=");v[i][1]=v[i][1].split("&itag=").join(" [fmt=")+"]";a=d.createElement("a");a.href=v[i][0];a.innerText=v[i][1];u.appendChild(d.createElement("li")).appendChild(a)}})()
@ww24
ww24 / gist:1723052
Created February 2, 2012 11:29
node game install, start
#!/usr/bin/env node
var util = require('util'),
cp = require('child_process'),
fs = require('fs'),
os = require('os').platform(),
argv = process.argv,
message = [
'Usage: node game [command]',
'',
@ww24
ww24 / Bookmarklet.js
Created March 20, 2012 02:11
ブラウザで開いている画像をBase64エンコードするブックマークレット
javascript:(function(){var x=new XMLHttpRequest();x.open('GET',location.href);x.overrideMimeType('text/plain;charset=x-user-defined');x.onload=function(){var n=[],b=x.responseText,a=[];for(var s=b.length,i=0;i<s;i++){n[i]=b.charCodeAt(i)&0xff}for(var l=n.length,i=0;i<l;i++){a[i]=parseInt(n[i],10).toString(2);for(var p=8-a[i].length,j=0;j<p;j++){a[i]='0'+String(a[i])}}a=a.join('');n=a.length%6;if(n!==0){for(var l=6-n,i=0;i<l;i++){a+='0'}}b=[];for(var l=a.length/6,i=0;i<l;i++){var m='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',n=parseInt(a.substr(i*6,6),2);b[i]=m.substr(n,1)}b=b.join('');n=b.length%4;if(n!==0){for(var l=4-n,i=0;i<l;i++){b+='='}}window.open('data:image/png;base64,'+b,'')};x.send(null)})();
@ww24
ww24 / recursive-object-merge.js
Created March 24, 2012 11:59
再帰的なオブジェクトのマージ
/*
* 再帰的なオブジェクトのマージ 1 (クロスブラウザ)
*/
var merge = function merge(a, b) {
for (key in b) {
if (b.hasOwnProperty(key)) {
a[key] = (key in a)
? ((typeof a[key] === "object" && typeof b[key] === "object")
? merge(a[key], b[key]) : b[key]) : b[key];
}