Skip to content

Instantly share code, notes, and snippets.

@doloopwhile
doloopwhile / gist:5115016
Last active December 14, 2015 16:28
コミット時にPHPファイルに文法エラーが無いかチェックする、git pre-commitスクリプト
#!/bin/bash
p1='\.(php|inc|view|edit|check|wui|mod|cnf|hlp|)$'
p2='resource/.*/locale/'
root=$(git rev-parse --show-toplevel)
files=($(git diff --name-only --cached | egrep "$p1|$p2" | sed -e "s|^|$root/|"))
failed=0
for f in "${files[@]}"; do
php -l "$f" > /dev/null || failed=1
done
@doloopwhile
doloopwhile / gist:5151079
Last active December 14, 2015 21:28
コミット時にNGワードが含まれていないかチェックする
#!/usr/bin/python3
# コミット時にNGワードが含まれていないかチェックする
import sys
import re
import os.path
import io
import itertools
from subprocess import check_output
from fnmatch import fnmatch
@doloopwhile
doloopwhile / gist:5180967
Created March 17, 2013 10:28
dummy-git-hook
#!/bin/bash
echo "dummy!"
@doloopwhile
doloopwhile / gist:5210306
Last active December 15, 2015 05:39
最新版のGitをインストールする
cd /tmp
wget --no-check-certificate https://github.com/git/git/archive/master.tar.gz
tar xvf master.tar.gz
# for CentOS
# sudo yum install -y gcc zlib zlib-devel curl curl-devel expat expat-devel gettext openssl-devel
# for Debian
# sudo aptitude install build-essential zlib1g zlib1g-dev curl libcurl4-openssl-dev libexpat1 libexpat1-dev gettext
@doloopwhile
doloopwhile / gist:5226989
Last active December 15, 2015 07:59
最新版のVimをインストールする
# for Debian
# sudo aptitude install mercurial gettext libncurses5-dev
# for CentOS
# sudo yum install gettext ncurses-devel -y
# # mercurial
# sudo yum install gcc python python-devel python-setuptools -y
# sudo easy_install mercurial
@doloopwhile
doloopwhile / gist:5387620
Created April 15, 2013 12:10
dummy fail hook
#!/bin/bash
echo 'dummy fail!'
exit 1
#!/bin/sh
pep8 `git rev-parse --show-toplevel`
@doloopwhile
doloopwhile / CoffeeScript.md
Last active December 16, 2015 11:19
What is CoffeeScript?
@doloopwhile
doloopwhile / gist:5567270
Last active December 17, 2015 06:39
【navona】JavaScriptの、古いブラウザでエラーになるパターンを警告する
#!/bin/bash
DIRS=(
$(git rev-parse --show-toplevel)/navona/MailInspector/mi/lib
$(git rev-parse --show-toplevel)/navona/MailInspector/mi/resources
$(git rev-parse --show-toplevel)/navona/MailInspector/mi/mi
$(git rev-parse --show-toplevel)/navona/MailInspector/mi/sys/agent
)
pcregrep -r -M ',\s*}' ${DIRS[@]}
if [ $? -ne 1 ]; then
@doloopwhile
doloopwhile / gist:5676762
Created May 30, 2013 09:29
array_transpose
function array_transpose($array_of_array) {
$column_keys = array();
foreach ($array_of_array as $row_key => $array) {
$column_keys = array_merge($column_keys, array_keys($array));
} $column_keys = array_unique($column_keys);
$transposed_array = array();
foreach ($column_keys as $column_key) {
$transposed_array[$column_key] = array();
foreach ($array_of_array as $row_key => $array) {