Skip to content

Instantly share code, notes, and snippets.

View antoniojps's full-sized avatar
🐬
Always learning

António Santos antoniojps

🐬
Always learning
View GitHub Profile
@antoniojps
antoniojps / composer-autoload.php
Created June 13, 2017 21:50
Composer Namespaces Autoload
namespace Bioliving\Database;
// Depois atualizar o composer.json com:
"autoload": {
"psr-4": {
"Bioliving\\": "src/config"
}
}
@antoniojps
antoniojps / github.pl
Last active July 31, 2018 02:02
Github commands
# Iniciar
git init
# Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.
# "Stage"
git add -A
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.
git commit -m "First commit"
// começar ficheiro em modo debugging
// Entra no modo debugging
node inspect file.js~
// mostra nLinhas de codigo em cima em baixo
list(nLinhas)
// executar linha a linha (n de next)
n

start mongo db

$ cd ~/mongo/bin
$ ./mongod --dbpath ~/mongo-data (or w.e path)
or
$ cd ~/mongo/bin && ./mongod --dbpath ~/mongo-data (or w.e path)
or
$ brew services start [email protected]

Mac OS Shortcuts

General

  • ⌘ + Tab switch between apps
  • Press q to quit an app from this place
  • ⌘ + Backtick to switch between multiple windows of an app
  • Cntrl + ⌘ + F to go fullscreen or windowed
  • ⌘ + T for a new tab
  • ⌘ + Shift + T to reopen a closed tab
  • Crank up Key Repeat in your keyboard setting

Utilizar ou não ponto-e-vírgulas

O syntax parser do javascript adiciona ponto-e-virgulas automaticamente. (ASI: automatic semicolon insertion)

Erros possíveis:

randomNumber(x){
    return 
    {
 number : x
{
"eslint.validate": [
"javascript",
"javascriptreact",
"vue"
],
"editor.fontFamily": "Consolas , Menlo, Monaco, 'Courier New', monospace, 'Apple Color Emoji'",
"editor.fontSize": 14,
"terminal.integrated.shell.osx": "zsh",
"[markdown]": {
@antoniojps
antoniojps / vue-animations.vue
Created July 15, 2018 14:24
vue animations
<template>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<h1>Animations</h1>
<hr>
<button class="btn btn-primary" @click="show=!show">Show alert</button>
<br><br>
<transition name="fade">
<div class="alert alert-info" v-if="show">This is some info</div>
@antoniojps
antoniojps / es7-async-await.js
Created July 19, 2018 09:45
async await & error handling
const axios = require('axios');
const getExchangeRate = async (from, to) => {
try {
const response = await axios.get('http://data.fixer.io/api/latest?access_key=d32d75de5146611ae7f23de0782ac09b');
const euro = 1 / response.data.rates[from];
const rate = euro * response.data.rates[to];
if (isNaN(rate)) {
throw new Error();
@antoniojps
antoniojps / laravel-setup.md
Created October 18, 2018 18:05
Laravel setup

Set up env

vagrant up

Migrate and seed db

php artisan migrate:refresh --seed

Destroy env

vagrant destroy