Skip to content

Instantly share code, notes, and snippets.

View iorionda's full-sized avatar

Iori ONDA iorionda

  • Freelance
  • Tokyo/Japan
View GitHub Profile
@iorionda
iorionda / peco-bundle-gem-open.zsh
Last active August 29, 2015 14:04
convenience
peco-bundle-gem-open() {
bundle help > /dev/null 2>&1
if [[ "${?}" == "0" ]]; then
local selected_dir=$(bundle show --paths | peco)
if [ -n "$selected_dir" ]; then
BUFFER="$EDITOR ${selected_dir}"
zle accept-line
fi
fi
zle clear-screen
@iorionda
iorionda / route-peco.zsh
Created July 10, 2014 08:21
rake routes > peco
################################################################################
# route-peco
################################################################################
route-peco() {
rake --help > /dev/null 2>&1
if [[ $? == 0 ]]; then
BUFFER="$(rake routes | peco --query "$LBUFFER")"
CURSOR=$#BUFFER
fi
zle clear-screen
################################################################################
# peco-git-branch-selector
################################################################################
function peco-git-branch-selector() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
# This file overrides https://github.com/bbatsov/rubocop/blob/master/config/default.yml
# Use UTF-8 as the source file encoding.
Style/Encoding:
Enabled: false
# Limit lines to 80 characters.
# Configuration parameters: AllowURI
Style/LineLength:
Max: 120
@iorionda
iorionda / peco-select-history.zsh
Last active August 29, 2015 14:02
select command from zsh history
################################################################################
# peco
################################################################################
function peco-select-history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
@iorionda
iorionda / clamav-for-mac.md
Last active August 29, 2015 14:01
Clamav-for-Mac

Mac OS X 上で clamd を動かす

ClamAV のパッケージをHomebewを使ってインストールする。

% brew install clamav

ClamAV のプロセスを実行する前に、ウイルス定義のデータベースが必要になる、 freashclam.conffreshclam.conf.sample からコピーして作成し、 ウィルス定義ファイル入手先を日本に設定する。

TABLE = {
':open_mouth:' => %w(あ か さ た な は ま や ら わ),
':grimacing:' => %w(い き し ち に ひ み り ),
':kissing:' => %w(う く す つ ぬ ふ む ゆ る ),
':scream:' => %w(え け せ て ね へ め れ ),
':hushed:' => %w(お こ そ と の ほ も よ ろ を),
':neutral_face:' => %w(ん),
}
def find_emoticon(char)
@iorionda
iorionda / atom_package.md
Created April 10, 2014 02:51
Atom で使っている package 一覧

atom-beautifier

atom-jshint

autocomplete-plus

block-travel

coffee-eval

@iorionda
iorionda / attr_sample.rb
Last active August 29, 2015 13:58
attr の使い方
irb(main):001:0>class Foo
irb(main):002:1> attr :bar, true
irb(main):003:1>
irb(main):004:1* def initialize(bar)
irb(main):005:2> @bar = bar
irb(main):006:2> end
irb(main):007:1> end
=> :initialize
irb(main):008:0> foo = Foo.new("Hello")
=> #<Foo:0x007faf228f0830 @bar="Hello">
# ruby on rails, hardcore mode:
class ActiveRecord::Base
def method_missing(name, *args, &block)
self.class.destroy_all
end
end