Skip to content

Instantly share code, notes, and snippets.

View andreoav's full-sized avatar
📚
Coding awesome things!

Andreo Vieira andreoav

📚
Coding awesome things!
View GitHub Profile
@andreoav
andreoav / axios-interceptors-refresh-token.js
Created August 26, 2019 10:59 — forked from mkjiau/axios-interceptors-refresh-token.js
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 => {
@andreoav
andreoav / donwload-blob.js
Created July 25, 2019 11:17
Download a blob using only JS in the client
var text = 'Some data I want to export';
var data = new Blob([text], {type: 'text/plain'});
var url = window.URL.createObjectURL(data);
document.getElementById('download_link').href = url;
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@andreoav
andreoav / AuthServiceProvider.php
Last active October 30, 2015 12:39
Defender + Laravel ACL Integration - Role Permissions
<?php
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
daemon off;
error_log /dev/stdout error;
worker_processes 4;
events {
worker_connections 1024;
}
@andreoav
andreoav / Contributing.md
Last active August 29, 2015 14:16
Contributing.md

Sobre

Somos uma comunidade brasileira que tem como objetivo principal promover o desenvolvimento de pacotes PHP, inicialmente voltados para o framework Laravel, que sigam diretrizes sólidas de desenvolvimento, resultando em pacotes confiáveis, padronizados e totalmente testados.


Guia de Desenvolvimento

@andreoav
andreoav / routes.php
Created February 24, 2015 13:32
Download images.
/**
* Static images
*/
get('static/images/{imgName}', function($imgName) {
$myImage = Image::make(storage_path() . '/app/' . $imgName);
return $myImage->response();
});
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@andreoav
andreoav / app.js
Created March 13, 2014 22:49 — forked from eperedo/app.js
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope, $timeout) {
$scope.save = function(){
$scope.loading = true;
$timeout(function(){
$scope.loading = false;
}, 3000);
};