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
class A < ActiveRecord::Base
validates :phoneNum1, numericality: { only_integer: true }
validates :phoneNum2, numericality: { only_integer: true }
validates :phoneNum3, numericality: { only_integer: true }
def phoneNum1
phoneNum && phoneNum.split("-")[0]
end
def phoneNum2
phoneNum && phoneNum.split("-")[1]
@marocchino
marocchino / 1.user_before_test.spec.coffee
Last active August 29, 2015 13:56
instance variable test
class Problem
ERROR:
tooComplicated: new Error "I can't do that"
constructor: ->
@tokens = ["some", "tokens"]
answer: ->
if @tokens
throw @ERROR.tooComplicated

분산 테스트 실행 시스템 RRRSpec을 출시하였습니다.

  • 2014년 3월 24일

기술부 알바 스즈키(@draftcode) 입니다.

쿡패드가 내부용으로 개발/운영해온 분산 테스트 실행 시스템 RRRSpec을 오픈 소스로 공개했습니다. RRRSpec은 시간이 걸리는 자동화 된 테스트를 분산 처리 하여 전체 테스트 시간을 단축하는 애플리케이션입니다. 현재 쿡패드에서는 17,000개가 넘는 테스트가 있어서 컴퓨터 한 대에서 테스트를 실행하면 완료하는 데 몇 시간이 걸립니다. 이 테스트를 60개의 머신에서 병렬 분산 처리 함으로써 평균 8분에서 9분 정도에 완료할 수 있게 되었습니다. 또한, Amazon EC2 스팟 인스턴스를 사용함으로써 상당한 비용 절감 효과도 동시에 달성했습니다.

https://github.com/cookpad/rrrspec

Taskset_-_RRRSpec

post "/reservation" do
# get duedate from event
if duedate < Time.now
# submit
else
redirect "/form?error_code=1", 303
end
end
get "/form" do
require 'benchmark'
n = 5_000_000
Benchmark.bm do |x|
x.report { n.times do ; { "x" => 1, "y" => 2}; end }
x.report { n.times do ; { 'x' => 1, 'y' => 2}; end }
end
# first
class User
attr_accessor :age
def initialize
@age = 0
end
def birthday
puts 'happy birthday!'
birthday_act
@age += 1
# This script is used with the Ruby on Rails' new project generator:
#
# rails new my_app -m http://emberjs.com/edge_template.rb
#
# For more information about the template API, please see the following Rails
# guide:
#
# http://edgeguides.rubyonrails.org/rails_application_templates.html
# Install required gems
@marocchino
marocchino / TIL.md
Last active August 29, 2015 14:15
리베이스된 리모트 브렌치 가져오기.

뭐 예를 들어, 회사 컴퓨터로 작업하다 force push하고 집에 와서 작업을 이어해야하는 상황에서 그냥 평범(?)하게 pull하면 컨플릭트가 납니다.

이럴 때는 이렇게 하면됩니다.

git fetch --all
git reset --hard origin/som_work

alias도 만듬.

@marocchino
marocchino / TIL.md
Last active August 29, 2015 14:15
VIM 스펠 체크에서 한국어 제외하기

VIM 스펠 체크에서 한국어 제외하기

vim의 스팰 체크는 나 같은 영어 못하는 사람한테는 매우 유용한 기능이다.

문제는 한글파일을 열면 전부 오타로 인식한다는 것.

Imgur

이렇게...

찾아보니 나한테만 그런 문제가 있는 것 같지는 않다.

diff --git a/docs/docs/tutorial.md b/docs/docs/tutorial.md
index 3b4d8b2..64470ee 100644
--- a/docs/docs/tutorial.md
+++ b/docs/docs/tutorial.md
@@ -5,7 +5,7 @@ prev: getting-started.html
next: thinking-in-react.html
---
-We'll be building a simple but realistic comments box that you can drop into a blog, a basic version of the realtime comments offered by Disqus, LiveFyre or Facebook comments.
+We'll be building a simple, but realistic comments box that you can drop into a blog, a basic version of the realtime comments offered by Disqus, LiveFyre or Facebook comments.