Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 750 Bytes

20210503.md

File metadata and controls

25 lines (19 loc) · 750 Bytes

75 - Tyga

2021. 05. 03

  1. git switch -c: 새로 만든 브랜치로 전환

  2. source tree에서 재배치 하고 yarn

  3. rails reject

    • returns new array containing the items in self for which the given block is not true
# Remove even numbers
(1..30).reject { |n| n % 2 == 0 }
# => [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]

# Remove years dividable with 4 (this is *not* the full leap years rule)
(1950..2000).reject { |y| y % 4 != 0 }
# => [1952, 1956, 1960, 1964, 1968, 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000]

# Remove users with karma below arithmetic mean
total = users.inject(0) { |total, user| total += user.karma }
mean = total / users.size
good_users = users.reject { |u| u.karma < mean }