Skip to content

Instantly share code, notes, and snippets.

View sharapeco's full-sized avatar
💭
Tengo hambre

Shinichiro Yabu sharapeco

💭
Tengo hambre
View GitHub Profile
@sharapeco
sharapeco / SQL
Created September 17, 2013 05:09
[xyzzy] SQL-mode キーワードファイル
; 逸見さんご提供
ABORT
action
admin
after
aggregate
alias
all
allocate
alter
@sharapeco
sharapeco / qrcode.js
Created October 18, 2013 01:33
現在表示しているページのURLをQRコードで表示するブックマークレット。 http://blog.self.li/post/16366939413/how-to-convert-bookmarklet-to-chrome-extension ここから Opera/Chrome 用の拡張機能を作れる。
var d = document
, container = d.body
, div = d.createElement("div")
, divStyle = div.style
, img = d.createElement("img")
, styles = {
position: "fixed"
, left: "20px"
, top: "20px"
, zIndex: "9999"
@sharapeco
sharapeco / make-mp3-oga.sh
Created October 20, 2013 11:39
オーディオファイルをMP3とOggに変換して作業ディレクトリに放り込む
#!/bin/sh
FFMPEG="/usr/local/bin/ffmpeg"
if [ $# -ne 1 ]; then
echo "From AIFF to MP3 and Ogg" 1>&2
echo "usage: ./conv.sh <aiff>" 1>&2
exit 1
fi
@sharapeco
sharapeco / kill-google-maps-miles-feet.css
Created October 29, 2013 00:53
Google マップから目障りなマイル/フィート表示を消すスタイルシート
div[jsselect="scale:scalecontrol.scales"]
{ text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff; }
div[jsselect="scale:scalecontrol.scales"][jsinstance^="*"],
div[jsselect="bar:scalecontrol.bars"][jsinstance^="*"]
{ display: none; }
@sharapeco
sharapeco / markdown-misc.l
Last active December 27, 2015 23:29
xyzzy で Markdown を書くための設定
;;; -*- Mode: Lisp; Package: EDITOR -*-
;;;
;;; This file is not part of xyzzy.
;;;
;;; Markdown を HTML に変換したりする
;;;
;;; 改変 markdown-mode for #xyzzy (色付け & メジャーモード化) が必要
;;; https://gist.github.com/youz/1339252
(provide "markdown-mode")
@sharapeco
sharapeco / yutori-kana-mac.php
Last active December 28, 2015 16:18
かな入力用ゆとり辞書を作る
<?php
$ret = main();
exit($ret);
// https://code.google.com/p/mecab/ から
// mecab-jumandic-7.0-20130310.tar.gz をダウンロード
// 展開してできる ContentW.csv を使わせてもらう
//
// ああ,1430,1430,8661,感動詞,*,*,*,ああ,ああ,代表表記:ああ/ああ
// 愛,1133,1133,5256,名詞,普通名詞,*,*,愛,あい,代表表記:愛/あい 漢字読み:音 カテゴリ:抽象物
@sharapeco
sharapeco / jshint.l
Created December 4, 2013 06:03
xyzzy で JSHint
(defun jshint (&optional (filename (get-buffer-file-name)))
"jscript-mode: このファイルの文法チェック"
(interactive)
(let (command
(bufname "*JSHint*")
(noerror-message "No errors detected")
buf
line
col
(error-message nil))
@sharapeco
sharapeco / less-1.6.0-jvariable.patch
Created January 7, 2014 13:08
LESS を日本語の変数名に対応させるパッチ
diff -Naru less.orig/lib/less/parser.js less/lib/less/parser.js
--- less.orig/lib/less/parser.js 2014-01-02 02:36:49.000000000 +0900
+++ less/lib/less/parser.js 2014-01-07 22:04:08.000000000 +0900
@@ -921,7 +921,7 @@
variable: function () {
var name, index = i;
- if (input.charAt(i) === '@' && (name = $re(/^@@?[\w-]+/))) {
+ if (input.charAt(i) === '@' && (name = $re(/^@@?[\w一-龠ぁ-んァ-ヴ-]+/))) {
return new(tree.Variable)(name, index, env.currentFileInfo);
@sharapeco
sharapeco / download_test.php
Last active August 27, 2018 03:17
Content-Disposition: attachment で日本語ファイル名をダウンロードさせるテスト
<?php
$t = isset($_GET['t']) ? $_GET['t'] : null;
$org = '此のファイル test.php';
$fn = array(
'A: UTF-8 Raw' => 'Content-Disposition: attachment; filename="' . $org . '"',
'B: UTF-8 URL Encoded' => 'Content-Disposition: attachment; filename="' . rawurlencode($org) . '"',
'C: UTF-8 Base64 Encoded' => 'Content-Disposition: attachment; filename="=?utf-8?B?' . base64_encode($org). '?="',
'D: RFC 2231' => 'Content-Disposition: attachment; filename*=UTF-8\'\'' . rawurlencode($org),
@sharapeco
sharapeco / ef-lens.js
Created April 9, 2014 01:04
キヤノンのEFレンズの名前にマッチする正規表現
/\b(?:EF(?:-[SM])?|TS-E)[1-9][0-9]*(?:-[1-9][0-9]+)?mm F[0-9]+(?:\.[0-9]*[1-9])?(?:-[0-9]+(?:\.[0-9]*[1-9])?)?(?:L| DO)?(?: (?:コンパクト)?マクロ| フィッシュアイ)?(?: IS)?(?: III?)?(?: USM| STM)?(?: エクステンダー 1\.4×)?|\bMP-E65mm F2\.8 1-5×マクロフォト/