Skip to content

Instantly share code, notes, and snippets.

View giovanniantonaccio's full-sized avatar
🎯
Focusing

Giovanni Antonaccio giovanniantonaccio

🎯
Focusing
  • CI&T
  • Brazil
View GitHub Profile
@giovanniantonaccio
giovanniantonaccio / swap.js
Created September 20, 2019 13:43
Swap two integers
x = 24
y = 99
// Traditional way:
x = x + y
y = x - y
x = x - y
// if using ES6 this can be done using destructuring assignment array matching:
// [x, y] = [y, x]
@giovanniantonaccio
giovanniantonaccio / App.js
Last active September 19, 2019 20:47
Check if user is signed or not to application and redirects it accordingly
import React from 'react';
import { Router } from 'react-router-dom';
import history from './services/history';
import Routes from './routes';
function App() {
return (
<Router history={history}>
<Routes />
@giovanniantonaccio
giovanniantonaccio / global.js
Created July 22, 2019 21:43
ReactJS styled-components global reset
import { createGlobalStyle } from 'styled-components';
export default createGlobalStyle`
* {
margin: 0;
padding: 0;
outline: 0;
box-sizing: border-box;
}
@giovanniantonaccio
giovanniantonaccio / style.css
Last active July 18, 2019 21:11
Basic CSS snippet
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #ececf0;
font-family: "Helvetica Neue", "Helvetica", "Arial", "sans-serif";
text-rendering: optimizeLegibility !important;
@giovanniantonaccio
giovanniantonaccio / database.js
Last active July 12, 2019 20:12
Configure database credentials
module.exports = {
dialect: 'postgres',
host: 'localhost',
username: 'postgres',
password: 'docker',
database: 'gobarber',
define: {
timestamps: true,
underscored: true,
underscoredAll: true,
@giovanniantonaccio
giovanniantonaccio / .sequelizerc
Created July 12, 2019 20:09
How to configure sequelize folders
const { resolve } = require('path');
module.exports = {
'config': resolve(__dirname, 'src', 'config', 'database.js'),
'models-path': resolve(__dirname, 'src', 'app', 'models'),
'migrations-path': resolve(__dirname, 'src', 'database', 'migrations'),
'seeders-path': resolve(__dirname, 'src', 'database', 'seeds'),
}