Skip to content

Instantly share code, notes, and snippets.

View equinox79's full-sized avatar

Jun-ichiro Suzuki equinox79

View GitHub Profile
@equinox79
equinox79 / gist:633678
Created October 19, 2010 05:42
test.html
<html>
<body>
<p>aaaa</p>
</body>
</html>
@equinox79
equinox79 / manifest.json
Created June 9, 2011 04:02
chrome extentionのブラウザアクションでアイコンクリックするとブコメページに飛ばすやつのmanifest.json
{
"name": "hoge",
"version": "0.1",
"description": "ブコメページへ",
"icons": {
"128": "hoge.png"
},
"background_page": "background.html",
"browser_action": {
"default_title": "hoge",
@equinox79
equinox79 / background.html
Created June 9, 2011 04:03
chrome extentionのブラウザアクションでアイコンクリックするとブコメページに飛ばすやつのbackground.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<script>
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.windows.get(tab.windowId, function(window) {
if (window.focused) {
var jump_url = "http://b.hatena.ne.jp/entry/"+tab.url;
chrome.tabs.update(tab.id, {url: jump_url, selected: tab.selected}, null);
@equinox79
equinox79 / gist:2632821
Created May 8, 2012 05:36
はてブのブログパーツを動的に読み込む実験
<html>
<head>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
</head>
<body>
<p><a href="http://www.yahoo.co.jp/">yahoo</a></p>
<p><a href="http://www.google.co.jp/">google</a></p>
@equinox79
equinox79 / gist:2651846
Created May 10, 2012 08:16
perlの正規表現の「\w」について
use Encode;
$hoge = "あかさたな";
print "まっち" if($hoge =~ /\w/); # 出力されない
$hoge = decode('utf8', "あかさたな");
print "マッチ" if($hoge =~ /\w/); # 'マッチ'
$('img').css({
clip : 'rect(0px 640px 240px 0px)',
position: 'absolute'
})
@equinox79
equinox79 / gist:3136030
Created July 18, 2012 12:49
テキストにマッチする正規表現を生成(例:都道府県)
use Regexp::Assemble;
use Encode;
my $builder = Regexp::Assemble->new;
while(my $line = <DATA>){
$line = decode('utf8', $line);
$line =~ s/\r\n//g;
$builder->add(quotemeta $line);
}
@equinox79
equinox79 / newphoto2pyazo.pl
Created September 7, 2012 07:56
指定されたディレクトリを監視して画像ファイルがうpされるとpyazoに投稿
#!/usr/bin/env perl
use strict;
use warnings;
use File::Monitor::Lite;
use HTTP::Request::Common;
use IO::File;
use LWP::UserAgent;
my $upload_path = '/foo/bar'; # ここを直す
@equinox79
equinox79 / Root.pm
Created September 22, 2012 04:48
Nephiaで日本語の巻
# eg/lib/MyApp/Root.pm を少し改造
package MyApp::Root;
use strict;
use warnings;
use Encode;
use Nephia;
path '/' => sub {
@equinox79
equinox79 / memo.sh
Created September 22, 2012 15:36 — forked from ponkore/memo.sh
github上でgithubにフォークしたリモートリポジトリを本家リモートリポジトリに追随する
# http://d.hatena.ne.jp/haru-s/20110405/1302006637 に答えがそのままあるが、一応メモ
# github fork 追従 で見つけた
$ git remote
origin
# 本家のリモートリポジトリの短縮名を登録する.
$ git remote add github git://github.com/liquidz/misaki.git
# 本家の更新をローカルで反映させる.