Skip to content

Instantly share code, notes, and snippets.

View luanvuhlu's full-sized avatar

luan vu luanvuhlu

View GitHub Profile
@soulmachine
soulmachine / jwt-expiration.md
Last active June 19, 2025 15:38
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:

@Warchant
Warchant / sonarqube-docker-compose.yml
Last active June 30, 2025 15:13
docker-compose file to setup production-ready sonarqube
version: "3"
services:
sonarqube:
image: sonarqube
expose:
- 9000
ports:
- "127.0.0.1:9000:9000"
networks:
@darmbrust
darmbrust / JSch logging
Created November 6, 2014 22:59
A bit of example code that routes logging from Jsch to SLF4j (using Java 8)
import java.util.HashMap;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jcraft.jsch.JSch;
/**
* Demonstrates enabling and routing JSch (http://www.jcraft.com/jsch/) logging
* into SLF4J (http://www.slf4j.org/) logging using Java 8
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active July 2, 2025 18:14
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@keccers
keccers / map-test.html
Last active December 25, 2023 19:15
Google Maps Custom Zoom Controls
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Custom Controls Test</title>
@DavidMah
DavidMah / filedownloader.js
Created August 30, 2012 17:03
File Download requests using jquery/POST request with psuedo ajax
// Takes a URL, param name, and data string
// Sends to the server.. The server can respond with binary data to download
jQuery.download = function(url, key, data){
// Build a form
var form = $('<form></form>').attr('action', url).attr('method', 'post');
// Add the one key/value
form.append($("<input></input>").attr('type', 'hidden').attr('name', key).attr('value', data));
//send request
form.appendTo('body').submit().remove();
@jonnywray
jonnywray / AjaxBlockUIDecorator.java
Created May 11, 2011 23:51
Wicket decorator that uses jQuery to block the UI while an Ajax request completes
import org.apache.wicket.Component;
import org.apache.wicket.ajax.calldecorator.AjaxCallDecorator;
/**
* Ajax call decorator to block the page while the Ajax callback
* occurs.
*
* For some reason the jQuery plugin used for this decorator continues
* with a spinning wheel after the response is done until focus leaves
* the form component. Same thing happens on their web site. Find a better