Skip to content

Instantly share code, notes, and snippets.

View acro5piano's full-sized avatar
🏠
Working from home

Kay Gosho acro5piano

🏠
Working from home
View GitHub Profile
@acro5piano
acro5piano / active_record.rb
Last active September 6, 2016 16:38
has_secure_passwordでauthenticateメソッドが追加される仕組み ref: http://qiita.com/acro5piano/items/416c08a808c850e0477e
require_relative './secure_password'
class ActiveRecord
extend SecurePassword
end
@acro5piano
acro5piano / file0.sh
Last active September 21, 2016 07:13
Bashでテンプレートエンジンっぽいものを作った ref: http://qiita.com/acro5piano/items/26de28485142eeac37b1
# Render a template file
#
# $ cat template.txt
# ==========================
# Hello, I'm {{ name }}.
# It's {{ wheather }} wheather today.
# ==========================
#
# $ util::render_template template.txt 'name=bashist&wheather=good'
# ==========================
@acro5piano
acro5piano / file0.sh
Created September 8, 2016 01:41
「精神と時の部屋」コマンドを作った ref: http://qiita.com/acro5piano/items/d18114b34f6ebc7a0d8b
mkdir /tmp/a
cd /tmp/a
@acro5piano
acro5piano / .bash_aliases
Last active September 11, 2016 11:35
Bashにアラーム機能を搭載する(改) ref: http://qiita.com/acro5piano/items/12c829da344464134f37
alarm(){
echo "tmux detach-client; sleep 2; cowsay_to_single_pts $1" | at $2
}
@acro5piano
acro5piano / Dockerfile
Last active December 6, 2017 15:32
Docker Composeで手軽に開発環境を構築 (PHP+MySQL+Elasticsearch+Memcached) ref: https://qiita.com/acro5piano/items/1d907f81afd0fb3a199e
FROM mysql:5.6
COPY my.cnf /etc/mysql
@acro5piano
acro5piano / exec_on_change
Last active November 2, 2016 00:57
Bashで、ファイルが変更されたら特定のコマンドを実行する ref: http://qiita.com/acro5piano/items/006674d2bc79ce9c7b78
#!/bin/bash
usage(){
echo "Usage:"
echo " exec_on_change file command"
exit 1
}
die(){
echo $1
@acro5piano
acro5piano / file0.sh
Created September 14, 2016 01:13
markdown-stylesとinotify-toolsで、最高のドキュメント執筆環境を整えた ref: http://qiita.com/acro5piano/items/0b781d301571025cf168
sudo npm install -g markdown-styles
@acro5piano
acro5piano / Dockerfile
Last active September 22, 2016 03:36
Docker Composeで手軽に開発環境を構築 (すっきりPHPなど) ref: http://qiita.com/acro5piano/items/ac3bef8a9f8bb9fdbdd5
FROM php:7.0
RUN apt-get update
RUN apt-get install -y zlib1g-dev libjpeg-dev libpng-dev libfreetype6-dev
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gd
RUN docker-php-ext-install mysqli
@acro5piano
acro5piano / file0.txt
Last active October 18, 2016 08:10
Bash/Zshで、個人的に有用だと思っているエイリアス ref: http://qiita.com/acro5piano/items/a9a1d04b280114b55b7a
alias sum="awk '{a+=\$1}END{print a}'"
# 使い方
% seq 1 10
1
2
3
4
5
6
@acro5piano
acro5piano / file0.txt
Last active September 29, 2016 02:33
お気に入りのディレクトリを登録するZshプラグインを作った ref: http://qiita.com/acro5piano/items/8c6e40842acf3e159ed3
antigen bundle acro5piano/fd