Skip to content

Instantly share code, notes, and snippets.

@honbin
honbin / tmuxinator.md
Created October 11, 2012 08:51
tmuxinator

tmuxinatorとは

tmuxで起動するセッション定義を事前に設定できるツール

事前に必要な環境

  • tmux
  • gem

インストール方法

# reference url: http://jp.rubyist.net/magazine/?0038-MapAndCollect#l2
# map for lisp
# (map 'list (lambda (i) (+ i 1)) '(3 4 5 6))
#map for ruby
p [3, 4, 5, 6].map {|i| i + 1 } #=>[4, 5, 6, 7]
#collect for smalltalk
# #(3 4 5 6) collect: [:i | i + 1 ]
#collect for ruby
p [3, 4, 5, 6].collect {|i| i + 1 } #=>[4, 5, 6, 7]
# reference url: http://jp.rubyist.net/magazine/?0038-MapAndCollect#l2
#reduce for lisp
# (reduce (lambda (i j) (+ i j)) '(3 4 5 6))
#reduce for ruby
p [3, 4, 5, 6].reduce {|i, j| i + j } #=>18
#inject for smalltalk
# #(3 4 5 6) inject: 0 into: [:i :j | i + j ]
#inject for ruby
p [3, 4, 5, 6].inject(0) {|i, j| i + j } #=>18
## surround.vim how to
# ds'
foo 'b*ar' baz #=>foo b*ar baz
# cs'"
foo 'b*ar' baz #=>foo "b*ar" baz
#ys$)
a = Array.new *foo, bar #=> a = Array.new (*foo, bar)
@honbin
honbin / gist:4085110
Created November 16, 2012 07:31
create .gitkeep
#URL: http://d.hatena.ne.jp/conceal-rs/20100127/1264573975
find . -type d -empty -not -path './.git*' -exec touch {}\/.gitkeep \;
@honbin
honbin / ssl.conf
Created November 21, 2012 03:44
名前ベースのSSLバーチャルホスト設定
##
## SSL Virtual Host Context
##
NameVirtualHost *:443
#以下コメントアウト

#whats ElasticSearch Luceneベースの全文検索システム

#feature

  • HTTP API(REST)

##for example ###PUT

curl -XPUT http://localhost:9200/twitter/tweet/1 -d '{
<?php
class Test
{
private $hoge = "hoge";
public function __get($property)
{
if(property_exists($this, $property)) {
return $this->$property;
}
<?php
trait Accessors
{
public function __get($property)
{
if(property_exists($this, $property)) {
return $this->$property;
}
}
Dir.glob("controllers/*.rb").each { |r| require_relative r }