This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj = { | |
name: 'John Doe', | |
greet () { | |
console.log(`Hey ${this.name}`); | |
} | |
}; | |
obj.greet(); // Hey John Doe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will render the same result. We can also bind to a computed property that returns an object. This is a common and powerful pattern: | |
// HTML | |
<div v-bind:class="classObject"></div> | |
// JS | |
data: { | |
isActive: true, error | |
: | |
null | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JS | |
Vue.component('child', { | |
// camelCase in JavaScript | |
props: ['myMessage'], | |
template: '<span>{{ myMessage }}</span>' | |
}) | |
// HTML | |
<!-- kebab-case in HTML --> <child my-message="hello!"></child> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// iniciar composer e criar composer.json | |
composer init | |
// instalar dependecias | |
composer require nomeda/dependencia || composer require-dev nomeda/dependencia | |
composer install || composer update | |
// dump dos autoloads | |
composer dumpautoload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JSON WEB TOKEN | |
// A JSON Web Token (JWT) is a JSON object that is defined in RFC 7519 as a safe way to represent a set of information between two parties. The token is composed of a header, a payload, and a signature. | |
// Formula: | |
data = base64urlEncode( header ) + “.” + base64urlEncode( payload ) | |
signature = Hash( data, secret ); | |
// Standard fields: | |
// Issuer (iss) - identifies principal that issued the JWT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OBJECT ORIENTED PROGRAMMING PHP | |
// Constructor de objecto = class | |
// Propriedades e Metodos (funcoes) | |
class Person{ | |
public $name; | |
public $email; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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!') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ir a Xampp/apache/Conf/Extra | |
Adicionar: | |
<VirtualHost *:80> | |
DocumentRoot "C:/xampp/htdocs\labmm4\Bioliving-API\public" | |
ServerName slimapp | |
</VirtualHost> | |
Feito! |