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

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

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]
// 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
@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"
@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 / xampp-vh.txt
Last active June 22, 2017 14:04
Criar virtual host no Xampp
Ir a Xampp/apache/Conf/Extra
Adicionar:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs\labmm4\Bioliving-API\public"
ServerName slimapp
</VirtualHost>
Feito!
@antoniojps
antoniojps / http-cors.txt
Last active June 14, 2017 03:04
CORS: Cross-domain requests - CSRF - Cross Site Request Forgery PROTECTION
Debugging: chrome://net-internals/#events
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Credentials: 'Content-type, Authorization'
Access-Control-Allow-Origin: $ORIGIN
$ORIGIN = if(inWhitelist(requestOriginHeader) return requestOriginHeader
// Se esta na whitelist entao meter esse domain la
// Incluir ports no Allow Origin Header!!!
@antoniojps
antoniojps / es6-modules.js
Last active June 8, 2017 04:59
ES6 Modules
/*
Ficheiro: exported.js
*/
export const dataNascimento = '1996-08-15'// Apenas uma variavel/func o que for
export function idade(){
return (new Date().getFullYear() - dataNascimento)
}
// Ou tudo numa linha, estamos a exportar um objecto com todas as propriedades seleccionadas
/*
A promise is created with a resolve and reject function being
passed as arguments. Depending on the result, the appropriate function is
executed and a possible return value is passed as an argument.
*/
let promise = new Promise((resolve,reject)=>{
// then(func)
resolve('Ola!')
@antoniojps
antoniojps / php-oop.php
Last active June 13, 2017 19:37
PHP OOP
// OBJECT ORIENTED PROGRAMMING PHP
// Constructor de objecto = class
// Propriedades e Metodos (funcoes)
class Person{
public $name;
public $email;
}