일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- Rails
- 우분투
- 코틀린
- after_update
- 주차장 시스템
- change_column
- MySQL
- Visual Studio Code
- Kotlin
- install
- 설치
- docker
- Ruby on Rails
- Migrate
- docket
- ubuntu
- after_save
- 차량번호찾기
- RUBY
- Java
- 쿠버네티스
- 사용중인포트검색
- 우분투 24
- Time.znoe.now
- mac
- Orange Pi 3B
- 오랜지파이
- change_column_null
- 정규식
- 도커
- Today
- Total
목록Code Language/Ruby (11)
중고 신입이 개발해보기..
car_number_regex = %r{ \b # 단어 경계 (?: # 캡처하지 않는 그룹 (OR 연산을 위해 묶음) \d{2,3}[가-힣]\d{4} # 2~3자리 숫자 + 한글 + 4자리 숫자 (예: 788가5555) | # 또는 [가-힣]{2}\d{2}[가-힣]\d{4} # 2자리 한글 (시도) + 2자리 숫자 + 한글 + 4자리 숫자 (예: 서울24아1234) ) \b # 단어 경계}x # x 옵션으로 주석 및 공백 허용스트링에서 한국 차량번호를 찾는 정규식 def mask_korean_plate_number(number) return number if number.blank? # 번호판 끝 4자리 추출 last_four = number[-4..] ..
limit = nil limit.present?=> false limit = 0 limit.present? => true limit = 10 limit.present? => true limit = 'test' limit.present? => true limit = [] limit.present? => false limit = ['test', 1] limit.present? => true limit = nil limit.blank?=> true limit = 1 limit.blank?=> false limit = 'test' limit.blank?=> false limit = [] limit.blank?=> true limit = [1] limit.blank?=> false [31] pry(main)> l..
in_groups_of array를 특정갯수만큼 끊어서 호출하고 싶을때 arr = [ 5 , 6, 7, 8, 9, 10 , 11 , 12, 13, 14] arr.in_groups_of(5) { |ar| p ar } [5, 6, 7, 8, 9] [10, 11, 12, 13, 14] => nil arr.in_groups_of(7) { |ar| p ar } [5, 6, 7, 8, 9, 10, 11] [12, 13, 14, nil, nil, nil, nil] arr.in_groups_of(7, false) { |ar| p ar } [5, 6, 7, 8, 9, 10, 11] [12, 13, 14]
현재 시간 구하기 now = Time.now => 2020-07-07 18:37:25 +0900 그 시간을 유닉스 시간으로 unix_time = now.to_i => 1594114645 그걸 다시 ... 음.. Time.at(unix_time) => 2020-07-07 18:37:25 +0900 오늘 시작 시작 Time.now.beginning_of_day => 2020-07-07 00:00:00 +0900 오늘 마지막 시간 Time.now.end_of_day => 2020-07-07 23:59:59 +0900 utc로 변환 now_utc = now.utc => 2020-07-07 09:37:25 UTC 다시 로컬타임으로 now_utc.localtime => 2020-07-07 18:37:25 +0900
https://medium.com/steady-study/%EB%A3%A8%EB%B9%84-mixin-include-prepend-extend-%EA%B7%B8%EB%A6%AC%EA%B3%A0-concern-e691c92fb233 루비 mixin: include, prepend, extend 그리고 Concern 루비에서 module을 mixin하면 다중 상속과 비슷한, 또는 더 풍부한 효과를 낼 수 있습니다. mixin과 ActiveSupport::Concern에 대해 알아봅시다. medium.com
def 메소드(인수) ..... end
루비 설치 https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-18-04 우분투에서 rbenv 업데이트하기 https://www.endpoint.com/blog/2015/11/03/updating-rbenv-ruby-build-on-ubuntu cd ~/.rbenv git pull cd ~/.rbenv/plugins/ruby-build/ git pull for MAC https://pie001.github.io/entry/blog/0017/https://rorlab.org/rblogs/214 for mac 업데이트 하기.. - 새로운 루비 버전이 나와서 세팅해야될때.. $ brew..