Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Wesley Egberto wesleyegberto

🎯
Focusing
Block or report user

Report or block wesleyegberto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wesleyegberto
wesleyegberto / simple-control-value-acessor.ts
Created Sep 9, 2019
Base class to create Angular components
View simple-control-value-acessor.ts
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { forwardRef, Type } from '@angular/core';
/**
* Function to create the basic provider to components which use `ngModel` as required by Angular.
* @param type component type which extends `SimpleControlValueAcessor`
*/
export function createProviders(type: Type<SimpleControlValueAcessor>) {
return [
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => type), multi: true }
View vim_cheatsheet.md

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@wesleyegberto
wesleyegberto / vim-cheatsheet.md
Created Sep 2, 2019 — forked from 0xadada/vim-cheatsheet.md
VIM movement, keyboard commands and shortcuts
View vim-cheatsheet.md
View api-blueprint-cheat-sheet
## Apiary
# API Blueprint Cheat Sheet
[API Blueprint](http://apiblueprint.org)(.apib) - API description format, plain text, Markdown-like.
## API Blueprint Document Structure
![](./api-blueprint-cheatsheet-image.png)
@wesleyegberto
wesleyegberto / jwt-expiration.md
Created May 29, 2019 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?
View jwt-expiration.md

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
wesleyegberto / RequestReplyFixed.java
Created May 29, 2019
Spring Boot - RabbitMQ - Request-Reply Pattern
View RequestReplyFixed.java
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
View np.java
import java.util.Arrays;
import java.util.Random;
/**
*
* @author Deus Jeraldy
* @Email: deusjeraldy@gmail.com
*/
public class np {
View ExportJsonFile.java
private ObjectMapper jsonMapper = new ObjectMapper();
private ExecutorService executorService = Executors.newFixedThreadPool(5);
@Async
public ListenableFuture<Boolean> export(UUID customerId) {
try (PipedInputStream in = new PipedInputStream();
PipedOutputStream pipedOut = new PipedOutputStream(in);
GZIPOutputStream out = new GZIPOutputStream(pipedOut)) {
Stopwatch stopwatch = Stopwatch.createStarted();
@wesleyegberto
wesleyegberto / git.md
Created Dec 28, 2018 — forked from leocomelli/git.md
Lista de comandos úteis do GIT
View git.md

#GIT

Estados

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

Ajuda

View progressiveImageLoader.directive.ts
import {
AfterContentInit, Directive, ElementRef, EventEmitter, Inject, Input, OnDestroy, Output, PLATFORM_ID,
Renderer2
} from "@angular/core";
import {isPlatformBrowser} from "@angular/common";
@Directive({
selector: '[image-loader]'
})
export class ProgressiveImageLoaderDirective implements AfterContentInit, OnDestroy {
You can’t perform that action at this time.