Skip to content

Instantly share code, notes, and snippets.


Adi Hermawan skinnyguy

  • PT. Indocyber Global Technology
  • @skinnyguy_
View GitHub Profile
whoisryosuke / nextjs-hoc-authorization.js
Created Jun 26, 2018
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
View nextjs-hoc-authorization.js
import React, {Component} from 'react'
import Router from 'next/router'
import AuthService from './AuthService'
export default function withAuth(AuthComponent) {
const Auth = new AuthService('http://localhost')
return class Authenticated extends Component {
static async getInitialProps(ctx) {
// Ensures material-ui renders the correct css prefixes server-side
ziluvatar / token-generator.js
Last active May 9, 2021
Example of refreshing tokens with jwt
View token-generator.js
* Example to refresh tokens using
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
* I create this gist just to help those who want to auto-refresh JWTs.
const jwt = require('jsonwebtoken');
ik5 / time_format.go
Created Nov 9, 2016
A full example of all possible time formats in Golang
View time_format.go
package main
import (
func main() {
fmt.Println("Times: ")
t := time.Now()