Skip to content

Instantly share code, notes, and snippets.

View joelbarbosa's full-sized avatar
🏠
Working from home

Joel Barbosa joelbarbosa

🏠
Working from home
View GitHub Profile
@joelbarbosa
joelbarbosa / ControlledComponent.js
Created November 17, 2017 13:01
Controlled Component
import React , { Component } from 'react';
export default class ControlledComponent extends Component {
constructor(props) {
super(props)
this.state = {
name: '',
idade: 0,
}
}
@joelbarbosa
joelbarbosa / gist:4b3490ade6b3f5ae4f6adf9e335a589e
Last active September 27, 2017 17:06
Execute all promises in a chain.
var a = new Promise(res => setTimeout(()=>{
res(1)
}, 2000));
var b = new Promise(res => setTimeout(()=>{
res(2)
}, 1000));
var c = (fn) => new Promise(res => console.log(fn));
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
module.exports = {
"extends": "airbnb",
"parser": "babel-eslint",
"plugins": [
"react",
"jsx-a11y",
"import",
"jest"
],
"globals": {
@joelbarbosa
joelbarbosa / index.html
Created April 20, 2017 18:03
JS Bin Observer parttern // source https://jsbin.com/jabebad
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Observer parttern">
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">