Skip to content

Instantly share code, notes, and snippets.

View marocchino's full-sized avatar
🏠
Working from home (7am~16pm JST)

marocchino

🏠
Working from home (7am~16pm JST)
View GitHub Profile

vim에서 url 인코딩

동기

pr 구경하다 나빼고는 다들 인코딩 잘해서 제목도 번역하는구나 싶어서 조금 해보고 싶어졌다.

검색

뭔가 ruby url encoding로 할까하다가 궅이 rake로 만들어봐야 쓸일이 별로 없을 것 같아서 그냥 url encoding으로 선회 웹에서 변환해주는 사이트를 발견했다. 생각해보니 js에서도 되는거 vim에도 돼지 않을까 싶어서 찾아보니 이미 있다. 내경우는 이미 인스톨도 해놨음.

@marocchino
marocchino / TIL.md
Created March 2, 2015 13:59
fish 에서 RAILS_ENV 사용하기

fish에서 RAILS_ENV하기

이 명령은 fish에서 쓸 수 없다.

$ RAILS_ENV=test rake db:migrate

는 건 알고 있었는데.. 오늘 마침 저걸 할일이 있어서 찾아보았다.

@marocchino
marocchino / bench.rb
Created August 14, 2015 02:56
Array#* vs Array.new
require 'benchmark'
n = 500_000_000_000_000
Benchmark.bm do |x|
x.report { ["a"] * 10 }
x.report { Array.new(10, "a") }
end
# user system total real
# 0.000000 0.000000 0.000000 ( 0.000012)

개발환경 설정하기

http://brew.sh 에 들어가서 Install Homebrew 밑에 명령어을 복사해서 터미널에 붙임.

노드 설치

brew install node
# language : ko
#UI관련 태스팅에 자주보이는 패턴.
#사실은 어떤 화면에 가는것도 유저 액션이니까 조건(Given)보단 만일(When)이 적절하다.
기능: UI안티패턴
좋은 태스트 코드를 쓰기 위해
프로그래머로써
공부한다.
기능: 로그인
시스템의 기능들을 이용하기 위해
사용자로써
로그인 하고싶다
배경:
조건 "사용자"님은 로그인상태입니다
# 시나리오들..
Given /^"([^"]+)"님은 로그인상태입니다$/ do |name|
user = User.new(:login => "test123", :name => "사용자", :email => "te...@test.com", :password => "test123", :password_confirmation => "test123", :role_id => 3, :state => "active")
user.create!
user.register!
user.activate!
visit '/login'
fill_in("login", :with => "test123")
fill_in("password", :with => "test123")
click_button "Log-in"
end
Given /^"([^"]+)"님은 로그인상태입니다$/ do |name|
$name = name
class ApplicationController
def current_user
session[:name] = $name
end
end
end
# file use
du -sh
# filesystem use rate
df -h