Skip to content

Instantly share code, notes, and snippets.

View wwkkww's full-sized avatar
🎯
Focusing

Kevin wwkkww

🎯
Focusing
View GitHub Profile
@wwkkww
wwkkww / RAILS_CHEATSHEET.md
Created May 11, 2022 05:11 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

@wwkkww
wwkkww / group-objects-by-property.md
Created April 11, 2022 12:17 — forked from mikaello/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value

Group array of JavaScript objects by keys

This fork of JamieMason's implementation changes the key parameter to be an array of keys instead of just a single key. This makes it possible to group by multiple properties instead of just one.

Implementation

const groupBy = keys => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = keys.map(key => obj[key]).join('-');