Menu Close

HTTP2 e baixa latência

No HTTP 2.X, o problema da alta latência é minimizado. Através de uma única conexão diversos recursos são baixados, o que é chamado de multiplexing.

Fonte: Alura.

Glob Pattern

Usamos o padrão ** para indicarmos que queremos copiar todas as pastas e * para indicar que queremos todos os arquivos dessa pasta.


Responsive E-mail Marketing

Some good reference: (pt-br) (pt-br)

O que é e-mail marketing responsivo e por que você precisa pensar nisso hoje? (pt-br)

Functional JavaScript

JavaScript’s C-like syntax, including curly braces and the clunky for statement, makes it appear to be an ordinary procedural language. This is misleading because JavaScript has more in common with functional languages like Lisp or Scheme than with C or Java. It has arrays instead of lists and objects instead of property lists. Functions are first class. It has closures. You get lambdas without having to balance all those parens. (

JavaScript Object Syntax

var paciente = { peso : 100, altura : 2.00 };

Mesma coisa que:

var paciente = {
    "peso" : 100, 
    "altura" : 2.00        


Protocolo HTTP

O HTTP é um protocolo que não mantém o estado de requisições.

Cada requisição é independente, e chamada de stateless.

Reactive programming

Reactive programming, not to be confused with functional reactive programming, is a subset of asynchronous programming and a paradigm where the availability of new information drives the logic forward rather than having control flow driven by a thread-of-execution.



ES7 Streams, Promises and Thunks

In ES7, promises will become monadic (by getting flatMap and unit). Also, we’re going to get generic syntax sugar for monads. Then, it trully wont matter what style you use – stream, promise or thunk – as long as it also implements the monad functions. That is, except for callback-passing style – it wont be able to join the party because it doesn’t produce values.

I’m just kidding, of course. I don’t know if thats going to happen. Either way, promises are useful and practical and will remain useful and practical in the future.


Implicit Grant Type – OAuth 2 Authorization Flow

From OAuth 2 Authorization Framework RFC

The implicit grant type is used to obtain access tokens (it does not
support the issuance of refresh tokens) and is optimized for public
clients known to operate a particular redirection URI. These clients
are typically implemented in a browser using a scripting language
such as JavaScript.

Since this is a redirection-based flow, the client must be capable of
interacting with the resource owner’s user-agent (typically a web
browser) and capable of receiving incoming requests (via redirection)
from the authorization server.

Unlike the authorization code grant type, in which the client makes
separate requests for authorization and for an access token, the
client receives the access token as the result of the authorization

The implicit grant type does not include client authentication, and
relies on the presence of the resource owner and the registration of
the redirection URI. Because the access token is encoded into the
redirection URI, it may be exposed to the resource owner and other
applications residing on the same device.

(A) The client initiates the flow by directing the resource owner’s
user-agent to the authorization endpoint. The client includes
its client identifier, requested scope, local state, and a
redirection URI to which the authorization server will send the
user-agent back once access is granted (or denied).

(B) The authorization server authenticates the resource owner (via
the user-agent) and establishes whether the resource owner
grants or denies the client’s access request.

(C) Assuming the resource owner grants access, the authorization
server redirects the user-agent back to the client using the
redirection URI provided earlier. The redirection URI includes
the access token in the URI fragment.

(D) The user-agent follows the redirection instructions by making a
request to the web-hosted client resource (which does not
include the fragment). The user-agent retains the
fragment information locally.

(E) The web-hosted client resource returns a web page (typically an
HTML document with an embedded script) capable of accessing the
full redirection URI including the fragment retained by the
user-agent, and extracting the access token (and other
parameters) contained in the fragment.

(F) The user-agent executes the script provided by the web-hosted
client resource locally, which extracts the access token.

(G) The user-agent passes the access token to the client.

Authorization Request

The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI
using the “application/x-www-form-urlencoded” format:

REQUIRED. Value MUST be set to “token”.

REQUIRED. The client identifier


OPTIONAL. The scope of the access request

RECOMMENDED. An opaque value used by the client to maintain
state between the request and callback. The authorization
server includes this value when redirecting the user-agent back
to the client. The parameter SHOULD be used for preventing
cross-site request forgery.

The client directs the resource owner to the constructed URI using an
HTTP redirection response, or by other means available to it via the

For example, the client directs the user-agent to make the following
HTTP request using TLS (with extra line breaks for display purposes

GET /authorize?response_type=token&client_id=s6BhdRkqt3&state=xyz
 &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb HTTP/1.1

The authorization server validates the request to ensure that all
required parameters are present and valid. The authorization server
MUST verify that the redirection URI to which it will redirect the
access token matches a redirection URI registered by the client.

If the request is valid, the authorization server authenticates the
resource owner and obtains an authorization decision (by asking the
resource owner or by establishing approval via other means).

When a decision is established, the authorization server directs the
user-agent to the provided client redirection URI using an HTTP
redirection response, or by other means available to it via the

4.2.2. Access Token Response

If the resource owner grants the access request, the authorization
server issues an access token and delivers it to the client by adding
the following parameters to the fragment component of the redirection
URI using the “application/x-www-form-urlencoded” format, per
Appendix B:

REQUIRED. The access token issued by the authorization server.

REQUIRED. The type of the token issued as described in
Section 7.1. Value is case insensitive.

RECOMMENDED. The lifetime in seconds of the access token. For
example, the value “3600” denotes that the access token will
expire in one hour from the time the response was generated.
If omitted, the authorization server SHOULD provide the
expiration time via other means or document the default value.

OPTIONAL, if identical to the scope requested by the client;
otherwise, REQUIRED.

REQUIRED if the “state” parameter was present in the client
authorization request. The exact value received from the

The authorization server MUST NOT issue a refresh token.

For example, the authorization server redirects the user-agent by
sending the following HTTP response (with extra line breaks for
display purposes only):

HTTP/1.1 302 Found

Developers should note that some user-agents do not support the
inclusion of a fragment component in the HTTP “Location” response
header field. Such clients will require using other methods for
redirecting the client than a 3xx redirection response — for
example, returning an HTML page that includes a ‘continue’ button
with an action linked to the redirection URI.

The client MUST ignore unrecognized response parameters. The access
token string size is left undefined by this specification. The
client should avoid making assumptions about value sizes. The
authorization server SHOULD document the size of any value it issues.

Prototype Methods ES6

class Car { // make new cars
 constructor(make, colour) { // add a prototype method
 this.make = make;
 this.colour = colour;

const beemer = new Car("BMW", "red");
const subie = new Car("Subaru", "white");
// console.log("my cars are: ", beemer, subie);

// Now, after the fact, I added on this prototype method:

Car.prototype.summarize = function() {
 return `This car is a ${this.make} in the colour ${this.colour}`; 

console.log(subie.summarize()); // This car is a Subaru in the colour white
console.log(beemer.summarize()); // This car is a BMW in the colour red

Source by @wesbos

© 2017 frontend pro. All rights reserved.

Theme by Anders Norén.