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 / 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">
module.exports = {
"extends": "airbnb",
"parser": "babel-eslint",
"plugins": [
"react",
"jsx-a11y",
"import",
"jest"
],
"globals": {
<!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">
@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));
@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 / UncontrolledComponents.js
Created November 17, 2017 16:05
Uncontrolled Components
import React , { Component } from 'react';
export default class ControlledComponent extends Component {
handleSubmit = event => {
const { name, idade } = event.target;
console.log(name.value, idade.value)
event.preventDefault()
}
@joelbarbosa
joelbarbosa / table-componente.txt
Created November 17, 2017 16:30
Componentes Controlados e Não Controlados.
╔═════════════════╦═════════════════╦═════════════╗
║ feature ║ Não Controlados ║ Controlados ║
╠═════════════════╬═════════════════╬═════════════╣
║ buscar valores ║ ║ ║
║ de um único ║ [ V ] ║ [ V ] ║
║ ponto ex:submit║ ║ ║
╠═════════════════╬═════════════════╬═════════════╣
║ validar ao ║ [ V ] ║ [ V ] ║
║ submit ║ ║ ║
╠═════════════════╬═════════════════╬═════════════╣
@joelbarbosa
joelbarbosa / gist:7eed77347f9c6258f0b62bf20e8b39c3
Created March 31, 2018 18:33 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@joelbarbosa
joelbarbosa / gist:145280f7f2f43bcdf377da217189d558
Last active November 7, 2018 04:11
diff arrays Javascript
const arr1 = [1, 2, 3, 4, 5];
const arr2 = [0, 2, 4, 6, 10, 11];
const DIFF = [1, 3, 5, 0, 6, 10, 11];
function diffWithFor(arr1, arr2) {
const holderArr = [];
for(let i = 0; i < arr1.length; i++) {
if (arr2.indexOf(arr1[i]) === -1) {
holderArr.push(arr1[i]);
function createNode(value) {
return {
value: value,
next: null
}
};
function createLinkedList() {
return {
head: null,