Skip to content

Instantly share code, notes, and snippets.

View gndplayground's full-sized avatar
👀
Looking for freelance work

Giang Nguyen gndplayground

👀
Looking for freelance work
View GitHub Profile
@gndplayground
gndplayground / refreshToken.ts
Last active April 27, 2023 09:50
Axios interceptor get new token when token expired example with typescript.
import axios from 'axios';
// Example request
// axios
// .get("http://localhost:8000/get?t=1")
// .then(() => {
// console.log("ok1");
// })
// .catch(e => {
@gndplayground
gndplayground / Article.md
Created June 10, 2018 02:49 — forked from Warry/Article.md
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

@gndplayground
gndplayground / 1_simple.go
Created April 5, 2018 03:56 — forked from sosedoff/1_simple.go
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@gndplayground
gndplayground / exampleWebpackConfig.js
Last active September 10, 2017 10:53
Babel loader use settings in Webpack 3 instead .babelrc
{
test: /\.js|jsx?$/,
loaders: [
{
loader: 'babel-loader',
options: {
babelrc: false,
presets: [
['es2015', { modules: false }],
'stage-2',