Skip to content

Instantly share code, notes, and snippets.

View Glideh's full-sized avatar

Pierre de LESPINAY Glideh

  • Masao
  • France
View GitHub Profile
@Glideh
Glideh / postman-prerequest-login.js
Last active November 9, 2023 08:49
Postman pre-request script to get a JWT if needed
/** Checks if the JWT is present and not expired
The token is expected to be found in `token` environment variable
*/
function isValidToken() {
const token = pm.environment.get("token");
if (!token) {
console.log("Token is missing");
return false;
}
// Payload is retrieved after JSON parsing the base64 decoded `atob()` 2nd part of the JWT `[1]`
@TheDruidsKeeper
TheDruidsKeeper / azure-pipelines-build-docker-with-cache.yml
Last active June 18, 2024 02:27
Azure DevOps pipeline with multi-stage docker image layer caching support
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
imageRepository: 'multi-stage-build-caching'
containerRegistry: 'ACR-Service-Connection-Name'
registryName: '[redacted].azurecr.io'
@bcnzer
bcnzer / postman-pre-request.js
Last active June 4, 2024 08:55
Postman pre-request script to automatically get a bearer token from Auth0 and save it for reuse
const echoPostRequest = {
url: 'https://<my url>.auth0.com/oauth/token',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
client_id:'<your client ID>',
client_secret:'<your client secret>',
@cowboy
cowboy / mock-axios.js
Last active June 19, 2024 13:51
axios mocking via interceptors
import axios from 'axios'
let mockingEnabled = false
const mocks = {}
export function addMock(url, data) {
mocks[url] = data
}
@nknapp
nknapp / Dockerfile
Created October 30, 2016 20:15
Traefik setup as reverse-proxy with docker and letsencrypt
FROM traefik:camembert
ADD traefik.toml .
EXPOSE 80
EXPOSE 8080
EXPOSE 443
@petrkohut
petrkohut / howto.md
Last active October 20, 2021 08:57
How to have redis-cli and psql installed on machine using Docker

How to install redis-cli and psql client on your machine with Docker

Preparing docker images

We will use minimalistic Linux distribution called Alpine (5MB)

Dockerfile of redis-cli

FROM alpine:latest
RUN apk --update add redis

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);