Skip to content

Instantly share code, notes, and snippets.

View wtospit's full-sized avatar

Witaya Tospitakkul wtospit

  • Odd-e (Thailand)
View GitHub Profile
@wtospit
wtospit / io.md
Created December 4, 2024 17:01 — forked from dcastro/io.md
IO vs Future and Referential transparency

The problem

These programs are safe to refactor:

object p1 {
  val x = 1 + 123
  val y = 1 + 123
}
@wtospit
wtospit / Jenkinsfile
Created November 15, 2024 02:16 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with CodeQL analysis steps, multiple stages, Kubernetes templates, shared volumes, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, Docker containers, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, …
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
spec:
containers:
- name: mvn
image: maven:3.3.9-jdk-8
@wtospit
wtospit / axios.refresh_token.1.js
Created August 8, 2021 16:22 — forked from Godofbrowser/axios.refresh_token.1.js
Axios interceptor for refresh token when you have multiple parallel requests. Demo implementation: https://github.com/Godofbrowser/axios-refresh-multiple-request
// for multiple requests
let isRefreshing = false;
let failedQueue = [];
const processQueue = (error, token = null) => {
failedQueue.forEach(prom => {
if (error) {
prom.reject(error);
} else {
prom.resolve(token);