Skip to content

Instantly share code, notes, and snippets.

Avatar renatorib

View GitHub Profile
View 1-formatDate.js
export const formatDate = (dateOrString, opts) => {
const date = new Date(dateOrString);
return new Intl.DateTimeFormat('pt-BR', opts).format(date);

New working branch (feature, bug, etc)

tgit new fs/xyz [-b master]

git checkout master               # ensure we are on master branch  
git pull origin master --rebase   # ensure master is up to date (fetch upstream && rebase)
git checkout -b fs/xyz            # create the new src branch  
git push -u origin @              # should we auto push new src branches to remote?

I. Should we auto push new src branches to remote? Maybe a opt-in flag?

renatorib / test.jstc
Last active Jul 13, 2019
some js type check
View test.jstc
type ActionsBlock = {
!type: 'actions'
!elements: [
| StaticSelectElement
| UsersSelectElement
# | ConversationsSelectElement
# | ChannelsSelectElement
# | ButtonElement
# | OverflowElement
# | DatepickerElement
renatorib /
Last active Jul 12, 2019
Slack Block Kit Json Schema

Slack Block Kit Json Schema

Open schema raw file

Schema extracted from
Probably the url/bundle will change every deploy so you might want to go, open devtools and search for that file (block-kit-builder) in source tab. Pass some unminify tool and search for "JSON Schema".

PS1: Some block/element types simply does not work, idk why.
PS2: If you want to explore easily, copy the code and paste to the devtools console.

renatorib / .gitignore
Created Aug 29, 2018
extract github followers
View .gitignore
renatorib / OnlyInClient.jsx
Last active May 31, 2018
SSR - Render Only In Client
View OnlyInClient.jsx
class OnlyInClient extends Component {
static defaultProps = { fallback: null }
state = { client: false }
componentDidMount() {
this.setState({ client: true })
render() {
if (!this.state.client) {
renatorib /
Last active Apr 11, 2018
Dan Abramov Q/A at React Brasil Slack (2018/04/11 - 18:00 GMT)

Dan, there are bigger plans to redux this year?

Not sure what you mean 🙂 But I have no plans regarding Redux personally. I'm not actively involved with maintaining it.

Andrew Clark said on his Twitter that class components will be considered as legacy APIs in the future, while function components will remain. We must take this statement in consideration in the projects that are under development/will be developed? And what is the best way to write a component?

He also said on Twitter that we have dozens of thousands of class components and they aren't going anywhere 🙂 When/if we have a more convenient and less verbose way to declare components than classes, we'll definitely announce it, but I don't see how it could affect existing projects.

renatorib / modal.jsx
Last active Apr 3, 2018
different ways to use two render props in one component
View modal.jsx
// passing object to render with two fns (opener & content, for example)
opener: ({ open }) => <button onClick={open}>Open Modal</button>,
content: {{ close }) => <div><h2>Hi modal</h2> <button onClick={close}>Close me</button></div>
// passing as children array
renatorib /
Last active Jan 9, 2018
1.0 Powerplug drafts



or MousePos, or MouseTrack, idk what is best name yet

Mouse is binded in a element, and your ratio values are relative to this element.

View mini-ramda.js
export const uncurry = (fn) => (...args) => {
let result = fn
for(i in args){
result = typeof result === 'function'
? result(args[i])
: result
return result