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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@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);
};
#! /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 / 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();
});
@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

daemon off;
error_log /dev/stdout error;
worker_processes 4;
events {
worker_connections 1024;
}
@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)
{

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

package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@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;