Skip to content

Instantly share code, notes, and snippets.

View bovas85's full-sized avatar

Alessandro Giordo bovas85

View GitHub Profile
Import-Module -Name D:\Temp\ACME-posh\ACMEPowerShell.psd1
$domain = "mydomain.com"
$certificiatePassword = "abcd1234"
$email = "letsencrypt@mydomain.com"
$vault = "D:\Vault\{0}\{1}" -f $domain, [guid]::NewGuid()
mkdir $vault
cd $vault
Initialize-ACMEVault -BaseURI https://acme-v01.api.letsencrypt.org/
New-ACMERegistration -Contacts mailto:$email
@bovas85
bovas85 / store.js
Created April 10, 2018 11:29
Cache API calls in Vuex on nuxtServerInit
import Vuex from "vuex";
import axios from "axios";
import Config from "~/assets/config.js";
const api = axios.create();
let arr = [];
let count = 0;
/**
* This is the secret sauce.
* If the data being requested is cached, subsequent API calls will not be made
* During a nuxt generate, nuxtServerInit will be called for every page
import Vuex from "vuex";
import Config from "~/assets/config.js";
let arr = [];
let count = 0;
const createStore = () => {
return new Vuex.Store({
...
actions: {
async nuxtServerInit ({ commit }, { app }) {
@bovas85
bovas85 / axios.js plugin
Last active September 16, 2023 12:46
NuxtServerInit caching mechanism
import { cacheAdapterEnhancer } from 'axios-extensions'
import LRUCache from 'lru-cache'
const ONE_HOUR = 1000 * 60 * 60
const defaultCache = new LRUCache({ maxAge: ONE_HOUR })
export default function ({ $axios }) {
const defaults = $axios.defaults
// https://github.com/kuitos/axios-extensions
defaults.adapter = cacheAdapterEnhancer(defaults.adapter, {