Skip to content

Instantly share code, notes, and snippets.


Wesley Egberto wesleyegberto

View GitHub Profile
wesleyegberto /
Created May 29, 2019 — forked from soulmachine/
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

wesleyegberto /
Created Dec 28, 2018 — forked from leocomelli/
Lista de comandos úteis do GIT



  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);


View progressiveImageLoader.directive.ts
import {
AfterContentInit, Directive, ElementRef, EventEmitter, Inject, Input, OnDestroy, Output, PLATFORM_ID,
} from "@angular/core";
import {isPlatformBrowser} from "@angular/common";
selector: '[image-loader]'
export class ProgressiveImageLoaderDirective implements AfterContentInit, OnDestroy {
wesleyegberto /
Created Sep 18, 2018 — forked from bmchild/
Example of how to wire up a chunked response and how to consume it via angular.
@RequestMapping(value = "/runJobAndGetLogs", method = RequestMethod.GET)
public ResponseEntity<StreamingResponseBody> runJobAndGetLogs() throws IOException {
final InputStream inputStream = someService.runJobAndGetReportProgress();
StreamingResponseBody body = StreamingResponseBody body = (outputStream) -> {
try (BufferedInputStream br = new BufferedInputStream(inputStream)) {
// just copying to the outputstream
byte[] contents = new byte[1024];
int bytesRead = 0;
while ((bytesRead = != -1) {
wesleyegberto / static_server.js
Created Aug 5, 2016 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
View static_server.js
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
You can’t perform that action at this time.