Skip to content

Instantly share code, notes, and snippets.

@cezarneaga
cezarneaga / Workshop Handout.md
Last active November 23, 2017 19:22
a sum-up of recorded knowhow

Reason Workshop @ReactiveConf 2017

by: Sean Grove, Jared Forsyth, Daniel Woelfel
support team: Cristiano Calcagno, @reasonvienna - @ryyppy @svensauleau @cezarneaga and @nikgraf in spirit, @matystl, @MyNaartjie

Support and Questions: Join discord channel

Workshop Presentation

  • workshop flow and exercises
@cezarneaga
cezarneaga / reasonReactChecklist.md
Last active November 5, 2017 19:17
setup checklist for ReasonReact

Check node and npm versions.

Ideally you should be on latest node v8.8 and npm 5.4.2.

If you use nvm make sure you are using the right version.

Initial setup

run npm install -g bs-platform

Editor setup

@cezarneaga
cezarneaga / filterByDateCond.js
Created September 26, 2017 07:26
Filter an array by date condition and return certain props only with Ramda.
const array = [{id: 1, createdAt: '2016-09-22 15:55:08'}, {id: 2, createdAt: '2017-11-22 15:55:08'}]
const dateCheck = date =>
new Date(date).getFullYear() >= new Date().getFullYear()
R.pluck('id', R.filter(R.propSatisfies(dateCheck, 'createdAt'))(array))
@cezarneaga
cezarneaga / filterArraysRamda.md
Last active April 26, 2023 07:52
Filter array of objects by nested values using ramda: Sometimes you dont have access to backend and you want to filter the response from an endpoint based on certain criteria. While trivial on flat arrays, this gets a bit tricky if the property you want to query is deeply nested. This is where Ramda shines.

Say we have a prop.users of the shape:

const users = [
    {username: 'bob', age: 30, tags: [{name: 'work', id: 1}, {name: 'boring', id: 2}]},
    {username: 'jim', age: 25, tags: [{name: 'home', id: 3}, {name: 'fun', id: 4}]},
    {username: 'jane', age: 30, tags: [{name: 'vacation', id: 5}, {name: 'fun', id: 4}]}
];
# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
name = Cezar Neaga
email = hi@cezarneaga.eu
[branch]
autosetuprebase = always
[color "status"]
added = green
changed = yellow