Skip to content

Instantly share code, notes, and snippets.

View omariosouto's full-sized avatar

Mario Souto omariosouto

View GitHub Profile
const dadosDoTweet = fetch('http://twitelum-api.herokuapp.com/tweets')
console.log(dadosDoTweet)
<h1>Gerador de Rodapés da Caelum</h1>
<input type="text" />
<button class="rodape-alura" data-rodape="rodape-alura">Rodapé Alura</button>
<script>
// # Usuario
// - clica no botao
@omariosouto
omariosouto / gist:8b4a776dae35a85be52c973129623921
Created July 31, 2018 09:33 — forked from palmerj3/gist:8249237
A simple example of a timer using requestAnimationFrame
<html>
<head>
</head>
<body>
<h1 id="display"></h1>
<script type="text/javascript">
(function() {
// Source: http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
const mapStateToProps = (stateDaStore) => {
return {
repos: stateDaStore.repos
}
}
const mapDispatchToProps = (dispatch) => {
return {
carregaRepos: () => {
fetch('https://api.github.com/users/omariosouto/repos').then((response) => response.json())
class MyComponent {
constructor(props) {
super()
const isServer = props.staticContext
if(isServer) {
this.state = {
repos: props.staticContext.repos
}
} else {
this.state = {
@omariosouto
omariosouto / getInitialData.js
Created May 29, 2018 22:15
React Charger: getInitialData()
class MyComponent {
static async getInitialData() {
try {
return {
repos: await fetch('https://api.github.com/users/omariosouto/repos').then((response) => response.json())
}
} catch(error) {
// Se algum erro acontecer: console.log(error)
return {
repos: []
@omariosouto
omariosouto / index.js
Created May 29, 2018 21:19
React Charger: React + React Router
import React, { Component } from 'react';
import Helmet from 'react-helmet'
import logo from '../../assets/img/react.svg';
import './Home.css';
import NavMenu from '../../components/NavMenu'
class Home extends Component {
static async getInitialData() {
try {
@omariosouto
omariosouto / modal.css
Created April 13, 2018 20:46
CSS Do Modal
.modal {
opacity: 0;
position: fixed;
width: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.4);
pointer-events: none;