Skip to content

Instantly share code, notes, and snippets.

@hamaco
hamaco / _shouldbee
Last active August 29, 2015 14:16
ShouldBee コマンド補完ファイル
#compdef shouldbee
function _shouldbee () {
local context curcontext=$curcontext state line
declare -A opt_args
local ret=1
_arguments -C \
'(-h --help)'{-h,--help}'[show help]' \
'(-v --version)'{-v,--version}'[print the version]' \
@hamaco
hamaco / speakerdeck.js
Created November 18, 2012 15:54
SpeakerDeck vimperator plugin.
(function() {
var SpeakerDeck = function() {
var doc = content.document;
if (doc.location.host !== 'speakerdeck.com') {
return liberator.echoerr('Current page is not speakerdeck.');
}
var iframe = doc.wrappedJSObject.getElementsByClassName('speakerdeck-iframe')[0];
var player = iframe.contentWindow.player;
@hamaco
hamaco / entries2.json
Created May 24, 2012 15:27 — forked from yandod/entries2.json
Plugin Catalog for CandyCane
{
"cc_nyancat":{
"id":"cc_nyancat",
"name":"Nyan down chart rocks!",
"description":"This is demonstration of plugin system.",
"url":"https:\/\/github.com\/downloads\/yandod\/cc_nyancat\/cc_nyancat-v0.3.1.zip",
"author":"yandod",
"author_url":"https:\/\/github.com\/yandod",
"version":"0.3.1"
},
@hamaco
hamaco / vim_install.sh
Created March 27, 2012 18:38
Vim install
#!/bin/sh
./configure \
--prefix=$HOME/app/vim-7.3 \
--disable-darwin \
--disable-selinux \
--enable-fontset \
--enable-gnome-check \
--enable-gui=gtk2 \
--enable-multibyte \
@hamaco
hamaco / gist:1289838
Created October 15, 2011 16:59
vim-quickrun-phpunit
augroup QuickRunPHPUnit
autocmd!
autocmd BufWinEnter,BufNewFile *_test.php set filetype=php.unit
autocmd BufWinEnter,BufNewFile *Test.php set filetype=php.unit
augroup END
let g:quickrun_config = {}
let g:quickrun_config['php.unit'] = {'command': 'phpunit'}
@hamaco
hamaco / gist:1205667
Created September 9, 2011 07:25
vimshellでのlsエラー(MacVim)
日本語メッセージ翻訳/監修: 村岡 太郎 <koron.kaoriya@gmail.com>
既にウィンドウは1つしかありません
lingr.vim has connected to Lingr
function vimshell#interactive#check_moved_output..<SNR>209_check_output..<SNR>209_cache_output..<SNR>91_read_pipes..<SNR>91_read..<SNR>91_vp_pipe_read..<SNR>91_libcall の処理中にエラーが検出されました:
行 4:
E368: got SIGHUP in libcall()
E364: "vp_pipe_read"() のライブラリ呼出に失敗しました
@hamaco
hamaco / mysql_transaction_sample.php
Created August 25, 2011 09:39
MySQLのトランザクションが…… => @suin
<?php
$con1 = mysql_connect("127.0.0.1", "root", null, true); mysql_select_db("test_db", $con1);
$con2 = mysql_connect("127.0.0.1", "root", null, true); mysql_select_db("test_db", $con2);
mysql_query("CREATE TABLE test (id int)engine=InnoDB", $con1);
mysql_query("BEGIN", $con1);
mysql_query("INSERT INTO test VALUES(1)", $con1);
mysql_query("INSERT INTO test VALUES(2)", $con2);
<?php
function pickupFromTextArea($needle, $subject) {
$pattern = "/{$needle}(.*)/";
if (preg_match($pattern, $subject, $matches) === 1) {
return trim($matches[1], "\r");
}
return false;
}