- 多くのデバイスで正しく見えるページを提供する
- 誰でもメンテナンスできるコードを提供する
- ヘッダやフッタなどの共通部品は1カ所にまとめる
- 静的なファイルとしてアップロードが可能
- ページ読み込み速度の軽減
- 変更履歴を管理
- ステージング環境の構築
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
protected_branch='develop' | |
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
if [ $protected_branch = $current_branch ] | |
then | |
read -p "You're about to push $protected_branch, is that what you intended? [y/N] " -n 1 -r < /dev/tty | |
echo | |
if echo $REPLY | grep -E '^[Yy]$' > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
http://la.ma.la/blog/diary_200601201204.htm | |
*/ | |
if(location.search=="?autoreload") { | |
var __autoreload_last_contents = new Array(); | |
setInterval(function(){ | |
var check = function(path) { | |
var onload = function() { | |
(__autoreload_last_contents[path] && req.responseText != __autoreload_last_contents[path]) && location.reload(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'eventmachine' | |
module Log2IRC | |
include EventMachine::Protocols::LineText2 | |
attr_reader :channels | |
class Message | |
attr_reader :line, :pattern, :match |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rails on GitHub | |
export APP=hogehoge | |
mkdir $APP | |
cd $APP | |
git init | |
rails $APP | |
git add log tmp | |
touch tmp/.gitignore log/.gitignore | |
echo "log/*.log" > .gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'kconv' | |
require 'iconv' | |
require 'nkf' | |
require 'test/unit' | |
class GuessEncoding < Test::Unit::TestCase | |
def setup | |
@euc = "うまく表示してね!".kconv(Kconv::EUC, Kconv::SJIS) | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'kconv' | |
require 'iconv' | |
require 'nkf' | |
require 'test/unit' | |
class GuessEncoding < Test::Unit::TestCase | |
def setup | |
# EUC-JP encoded うまく表示してね! | |
@euc = "¥345¥341¥254¥345¥242¥300¥345¥341¥276¥352¥241¥243¥245¥243¥356¥246¥245¥263¥345¥341¥316¥345¥242¥250¥345¥341¥245¥345¥376¥276" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# /etc/pm/sleep.d/00zbright | |
COMMAND=/usr/local/bin/zbright | |
SAVED_FILE=/tmp/zbright.tmp | |
case "${1}" in | |
suspend|hibernate) | |
$COMMAND | /usr/bin/gawk '{print $2}' > $SAVED_FILE | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# syntax: | |
# 'sudo zbright +N' increments screen brightness by N percent (N=0-100) | |
# 'sudo zbright -N' decrements screen brightness by N percent | |
# 'sudo zbright N' sets screen brightness to N percent | |
# 'sudo zbright' w/o any args reports current brightness | |
# | |
# note: must be run as sudo | |
# |
OlderNewer