Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Alexandre Magno alexanmtz

🎯
Focusing
Block or report user

Report or block alexanmtz

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
@alexanmtz
alexanmtz / Drawer-menu.js
Last active Jul 19, 2019
A tab menu example using Material-UI for react
View Drawer-menu.js
// styles
const styles = theme => ({
iconContainer: {
display: 'none',
[theme.breakpoints.down('sm')]: {
display: 'block'
}
}
})
@alexanmtz
alexanmtz / java_home_android.sh
Created Jul 16, 2019
Setting a JAVA_HOME in order to run android apps
View java_home_android.sh
# where jdk1.8.0_211.jdk is the target version in this example
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
@alexanmtz
alexanmtz / print.css
Created Jun 23, 2019
A example of a media query used for print
View print.css
@media print {
#header, #location, #sidebar, #footer, #respond, #wpml_credit_footer {
display: none;
}
#content {
width: 95%;
}
.entry {
padding: 0;
margin: 0;
@alexanmtz
alexanmtz / gist:ff05ea8e944d95bd5649852bf484e214
Created Jun 5, 2019 — forked from sergiosvieira/gist:8dcd5f43ba822b7cd5b7
Fluxo de Trabalho do Git para Pequenas Equipes
View gist:ff05ea8e944d95bd5649852bf484e214
Fluxo de Trabalho no Git
========================
Primeiro crie um branch de desenvolvimento no seu repositório local:
$ git checkout --track origin/development
1. Trabalhe em sua tarefa, continuamente comitando em intervalos regulares para manter
o rastro daquilo que você fez.
@alexanmtz
alexanmtz / auth.js
Last active Jan 13, 2019
Routes on front-end using react router
View auth.js
class Auth {
/**
* Authenticate a user. Save a token string in Local Storage
*
* @param {string} token
*/
/* eslint-disable no-undef */
static authenticateUser (token) {
localStorage.setItem('token', token)
}
@alexanmtz
alexanmtz / session.js
Created Jan 13, 2019
A Session component implemented on React to store in localStorage the user token
View session.js
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Auth from '../../modules/auth'
class Session extends Component {
componentWillMount () {
const token = this.props.match.params.token
const referer = Auth.getReferer()
Auth.authenticateUser(token)
@alexanmtz
alexanmtz / auth.js
Created Jan 13, 2019
Routes to authenticate
View auth.js
const express = require('express')
const router = express.Router()
const passport = require('passport')
const authenticationHelpers = require('../../authenticationHelpers')
require('../../../loading/loading')
const secure = require('./secure')
router.get('/authenticated', authenticationHelpers.isAuth)
router.get('/authorize/github', passport.authenticate('github', { scope: ['user:email'], accessType: 'offline' }))
View authenticationHelpers.js
/**
* Authentication helpers to determine if a user is logged in or not
* before a route returns information to the response
*/
const userExist = require('../modules/users').userExists
const jwt = require('jsonwebtoken')
function isAuthOrRedirect (req, res, next) {
if (req.isAuthenticated()) return next()
@alexanmtz
alexanmtz / passport.js
Created Jan 13, 2019
Authentication with Node.js, Express, Sequelize, JWT and webtokens
View passport.js
const {
github
} = require('./secrets')
const passport = require('passport')
const gitHubStrategy = require('passport-github2').Strategy
const LocalStrategy = require('passport-local').Strategy
const passportJWT = require('passport-jwt')
const ExtractJWT = passportJWT.ExtractJwt
const JWTStrategy = passportJWT.Strategy
const jwt = require('jsonwebtoken')
@alexanmtz
alexanmtz / git-export
Created Jan 2, 2019 — forked from kristofferh/git-export
"Export" a git repository to zip file
View git-export
git archive --format zip --output /full/path/to/zipfile.zip master
You can’t perform that action at this time.