Skip to content

Instantly share code, notes, and snippets.

@kenjikaneko
kenjikaneko / small_trick.md
Created November 8, 2012 07:15
small trick 集

##small trick 集 ###sudo.vim 使い方

  • 今開いているファイルがreadonly だった...
  • :e sudo:%
  • 特権ユーザーでファイルを開き直した!

###eregex.vim 使い方

  • 置換したい文字列に\を大量にいれなければいけないとき

#Slimとは Rail系のテンプレートエンジン(PHPでも使える) Hamlより記号などが省いておりシンプルに作れる

##インストール

gem install slim slim-rails

##Gemファイル記入

##vimからDBを操作する

###インストール vim-scripts/dbext.vim をBundleInstall ###設定 .vimrc に下記のように書き込む。

let dbext_default_profile = ""
let dbext_default_type = "MYSQL"
let dbext_default_user = "root"

#メソッドチェインとは 流れるようなインターフェース

3.weeks.ago
3.weeks.ago.saturday?

Product.whie(:price => 100 )
Product.order(:price).limit(10).offset(0)

(0..9).map{|i| i +1 }
@kenjikaneko
kenjikaneko / method.md
Created October 25, 2012 04:51
プログラミング言語Ruby, p285

#動的なメソッド定義

def add_method(c, m, &b)
  c.class_eval {
    define_method(m, &b)
  }
end

add_method(String, :greet) { "Hello, " + self }
"world".greet
@Gab-km
Gab-km / github-flow.ja.md
Last active April 23, 2025 04:19 — forked from juno/github-flow.ja.md
GitHub Flow (Japanese translation)
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.