Skip to content

Instantly share code, notes, and snippets.

🔥
_

Renato Ribeiro renatorib

🔥
_
Block or report user

Report or block renatorib

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View readme.md

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
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
renatorib / readme.md
Last active Jul 12, 2019
Slack Block Kit Json Schema
View readme.md

Slack Block Kit Json Schema

Open schema raw file

Schema extracted from https://a.slack-edge.com/bv1-6-8cacda2/block-kit-builder.93ca53691de7cf9d4417.min.js
Probably the url/bundle will change every deploy so you might want to go https://api.slack.com/tools/block-kit-builder, 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
renatorib / .gitignore
Created Aug 29, 2018
extract github followers
View .gitignore
outputs/*
config.js
@renatorib
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
renatorib / dan-abramov-QA.md
Last active Apr 11, 2018
Dan Abramov Q/A at React Brasil Slack (2018/04/11 - 18:00 GMT)
View dan-abramov-QA.md

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
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)
<Modal>
{{
opener: ({ open }) => <button onClick={open}>Open Modal</button>,
content: {{ close }) => <div><h2>Hi modal</h2> <button onClick={close}>Close me</button></div>
}}
</Modal>
// passing as children array
// https://stackblitz.com/edit/react-array-render-props
@renatorib
renatorib / drafts.md
Last active Jan 9, 2018
1.0 Powerplug drafts
View drafts.md

Drafts


Mouse

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.

IDEAL API
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
}
View toggle-opened.jsx
class ToggleOpened extends Component {
state = { opened: false }
toggle = () =>
this.setState(state => ({ opened: !state.opened }))
render() {
return this.props.render({
opened: this.state.opened,
toggle: this.toggle,
You can’t perform that action at this time.