Skip to content

Instantly share code, notes, and snippets.

@jiskanulo
jiskanulo / tig-completion.bash
Created April 17, 2014 04:53
tig oh-my-zsh plugin
##
# bash completion support for tig
#
# Copyright (C) 2007-2010 Jonas fonseca
# Copyright (C) 2006,2007 Shawn Pearce
#
# Based git's git-completion.sh: http://repo.or.cz/w/git/fastimport.git
#
# The contained completion routines provide support for completing:
#
@jiskanulo
jiskanulo / cdd
Created April 17, 2014 04:49
cdd oh-my-zsh plugin
# vim: ft=sh
# https://github.com/m4i/cdd
if [ -z "$CDD_FILE" ]; then
CDD_FILE=~/.cdd
fi
export CDD_FILE
if [ -z "$CDD_AUTO" ]; then
CDD_AUTO=1
@jiskanulo
jiskanulo / _homeshick
Created April 14, 2014 09:48
homeshick oh-my-zsh plugin
#compdef homeshick
_homeshick () {
local context state line curcontext="$curcontext" ret=1
_arguments -n : \
{-q,--quiet}'[Suppress status output]' \
'(-s --skip)'{-f,--force}'[Overwrite files that already exist]' \
'(-f --force)'{-s,--skip}'[Skip files that already exist]' \
{-b,--batch}'[Batch-mode: Skip interactive prompt]' \
{-h,--help}'[Help message]' \
update
# add repositories
tap homebrew/binary || true
tap homebrew/completions || true
tap homebrew/dupes || true
tap homebrew/versions || true
tap phinze/homebrew-cask || true
tap josegonzalez/php || true
@jiskanulo
jiskanulo / gist:9173498
Last active August 29, 2015 13:56
初めて自分のために書いたphp
<?php
function h($var) {
return htmlspecialchars($var, ENT_QUOTES, 'Shift_JIS');
}
function r($key, $escape=true) {
$value = (!empty($_REQUEST[$key])) ? $_REQUEST[$key] : null;
if ($escape!==true) return $value;
return h($value);
@jiskanulo
jiskanulo / hoge.php
Created December 9, 2013 11:54
hogehoge
<?php
class Hoge
{
public $hoge = array(1,2,3);
private $_page = array('a','b','c');
}
function falsificate(& $property)
server {
listen 8080;
server_name example.dev www.example.dev;
location / {
root /Users/Cobby/Sites/Example;
if ($host = 'www.example.dev' ) {
rewrite ^/(.*)$ http://example.dev:8080/$1 permanent;
}
@jiskanulo
jiskanulo / switch-subversion-servers
Last active December 18, 2015 00:48
.subversion/servers ファイルを予め2つ用意しておいてコマンド1つで切り替える
#!/bin/bash
subversion_base_config_path="${HOME}/.subversion"
config_file="${subversion_base_config_path}/servers"
function abort()
{
echo $1 2>&1
exit 1
}
@jiskanulo
jiskanulo / gist:4023269
Created November 6, 2012 07:36
Mac OS Xか否か判別
#!/bin/bash
os_x=""
if [ -x `which sw_vers` ]; then
os_x="${sw_vers} | grep 'Mac OS X'"
fi
if [ -n "$os_x" ]; then
echo "Mac OS X"
else
@jiskanulo
jiskanulo / gist:4023267
Created November 6, 2012 07:35
Homebrewでインストールしたphp53とphp54を切り替える
#!/bin/bash
if [ ! -x `which brew` ]; then
echo "Homebrew does not installed."
exit 1
fi
php_path=`which php`
php_real_path=`stat -F $php_path`