Skip to content

Instantly share code, notes, and snippets.

View rafael-angonese's full-sized avatar
💜

Rafael Angonese rafael-angonese

💜
View GitHub Profile
@VitorLuizC
VitorLuizC / Home.vue
Last active June 5, 2024 14:58
Exemplo de Autenticação com JWT em Vue.js
<template>
<h1>Página secreta!</h1>
</template>
@mkjiau
mkjiau / axios-interceptors-refresh-token.js
Last active March 13, 2024 10:59
Axios interceptors for token refreshing and more than 2 async requests available
let isRefreshing = false;
let refreshSubscribers = [];
const instance = axios.create({
baseURL: Config.API_URL,
});
instance.interceptors.response.use(response => {
return response;
}, error => {
@gene1wood
gene1wood / convert_ruby_hash_string_to_json.rb
Last active November 29, 2023 14:25
A set of regex converstions to turn a ruby hash output string into a json parseable string
require 'json'
# Example ruby hash string which exercises all of the permutations of position and type
# See http://json.org/
ruby_hash_text='{"alpha"=>{"first second > third"=>"first second > third", "after comma > foo"=>:symbolvalue, "another after comma > foo"=>10}, "bravo"=>{:symbol=>:symbolvalue, :aftercomma=>10, :anotheraftercomma=>"first second > third"}, "charlie"=>{1=>10, 2=>"first second > third", 3=>:symbolvalue}, "delta"=>["first second > third", "after comma > foo"], "echo"=>[:symbol, :aftercomma], "foxtrot"=>[1, 2]}'
puts ruby_hash_text
# Transform object string symbols to quoted strings
ruby_hash_text.gsub!(/([{,]\s*):([^>\s]+)\s*=>/, '\1"\2"=>')