Skip to content

Instantly share code, notes, and snippets.

View raimon49's full-sized avatar
🍺
lovecraftbeer

raimon raimon49

🍺
lovecraftbeer
View GitHub Profile
@raimon49
raimon49 / install-git-on-ubuntu.sh
Created September 18, 2012 13:01
UbuntuでGitのビルドに必要だったパッケージ
$ sudo apt-get install zlib1g-dev libicu-dev gettext libcurl4-openssl-dev
@raimon49
raimon49 / list10.js
Created October 28, 2012 11:05
WEB+DB PRESS Vol.71『プログラマのためのjQuery再入門』Deferredオブジェクト周りの写経
var cache = {};
function getFromCacheOrAPI(url) {
if (!cache[url]) {
cache[url] = $.get(url);
}
return cache[url];
}
getFromCacheOrAPI('/api/foo').done(function(data) {
@raimon49
raimon49 / event-api.js
Created October 28, 2012 11:24
WEB+DB PRESS Vol.71『プログラマのためのjQuery再入門』新旧イベントAPIの対応周りの写経
// $(elem).on('type', 'selector', handler)が$(elem).delegate('selector', 'type', handler)と同等
// 各td要素にaddEventListener相当の処理が実行される
$('table td').on('click', function(e) {
// td要素に対する処理
$(this).css('color', 'red');
})
// 親のtable要素だけにaddEventListenerしておき処理を委譲してもらう
$('table').on('click', 'td', function(e) {
@raimon49
raimon49 / gist:4006393
Created November 3, 2012 07:14
Vimに入れてるプラグインの数
$ egrep "^(Bundle|NeoBundle)" ~/.vimrc | wc -l
@raimon49
raimon49 / cleanup_submodule.sh
Created January 7, 2013 16:15
submoduleを掃除した時のメモ
# diff: https://github.com/raimon49/dotfiles/commit/db8b6eabff74c81d7548c68cbfdd4aafe6a62af3
$ git rm --cached .vim/neobundle.vim.git
$ git add .gitignore .gitmodules .vimrc install_cui.sh
$ git commit
$ cd ~
$ find . -maxdepth 1 -type l -print | xargs rm
$ find local/bin -maxdepth 1 -type l -print | xargs rm
$ cd ~/works/git
@raimon49
raimon49 / vim_install_log_on_xrea.sh
Last active December 14, 2015 22:59
XREAの新規サーバでVimをインストール。XREA+お試し期間にしておかないとquotaで死ぬ。cat patches/7.3.* | patch -p0だとパッチあてるのに失敗するのでfor文で。
# Vim本体の取得
$ wget ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2
$ bunzip2 vim-7.3.tar.bz
$ tar xf vim-7.3.tar
# 最新のパッチを取得
$ cd vim73
$ mkdir patches
$ cd patches
$ curl -O 'http://ftp.nluug.nl/vim/patches/7.3/7.3.[001-861]'
@raimon49
raimon49 / mercurial_install_log_on_xrea.sh
Created March 14, 2013 17:06
XREAにMercurialを入れる。
# Pythonのインストール
$ wget 'http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2'
$ tar jxf Python-2.7.3.tar.bz2
$ cd Python-2.7.3
$ ./configure --prefix=$HOME/local
$ make
$ make install
# distribute + pipのインストール
$ wget 'http://python-distribute.org/distribute_setup.py'
@raimon49
raimon49 / ruby-2.0.0-p0_install_log_on_xrea.sh
Created April 30, 2013 08:22
XREAにruby-2.0.0-p0を入れる。時間かかり過ぎて何度か強制終了…。
# Rubyの取得・展開
$ wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.bz2
$ bunzip2 ruby-2.0.0-p0.tar.bz2
$ tar xf ruby-2.0.0-p0.tar
# Rubyのコンパイル・インストール(強制終了した時は再度makeして再開)
$ ./configure --prefix=$HOME/ruby-2.0.0-p0 --disable-install-doc --disable-install-rdoc
$ make
$ make install
@raimon49
raimon49 / bundler_install_log_on_xrea.sh
Created December 1, 2013 07:59
tDiary 4.xをGitリポジトリで追いかけるためにXREAサーバにBundlerを入れる
# RubyGemsのインストール
$ cd ~/misc
$ wget http://production.cf.rubygems.org/rubygems/rubygems-2.1.7.tgz
$ tar zxf rubygems-2.1.7.tgz
$ cd rubygems-2.1.7
$ ~/ruby-2.0.0-p247/bin/ruby setup.rb --prefix=$HOME/rubygems
# gemコマンドも~/ruby-2.0.0-p247/binに入るのでPATHを通しておくと良い
# BundlerのインストールとtDiary依存ライブラリのインストール
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.3 LTS"
# Lua
$ sudo apt-get install lua5.2 liblua5.2-dev
# Vim