Skip to content

Instantly share code, notes, and snippets.

View resmall's full-sized avatar

Tiago R. Lammers resmall

View GitHub Profile
@resmall
resmall / docker-clear.sh
Last active January 21, 2020 21:04
clear docker images and inactive containers
docker rmi $(docker images -a --filter=dangling=true -q)
docker rm $(docker ps --filter=status=exited --filter=status=created -q)
docker images -a | grep "pattern" | awk '{print $3}' | xargs docker rmi
@resmall
resmall / axios-catch-error.js
Created October 10, 2019 20:19 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@resmall
resmall / array
Created August 14, 2018 18:19
array
["companyA", "companyB", "companyC"]
@resmall
resmall / sticky-footer.css
Created September 10, 2016 18:52
Sticky footer in CSS
@resmall
resmall / ruby_install.sh
Created January 6, 2016 18:41
instalação ruby
# Se durante o processo do sudo apt-get update ocorrer algum erro de pacote
# ou de destino nao encontrado, tem que deletar o repositorio
# pois nesse momento nao pode ocorrer nenhum erro senao o rvm chora
vagrant@homestead:~/Projects/acadrolli$ sudo apt-get update
Err http://dl.hhvm.com utopic/main amd64 Packages
404 Not Found [IP: 140.211.166.134 80]
Err http://dl.hhvm.com utopic/main i386 Packages
404 Not Found [IP: 140.211.166.134 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/main/source/Sources Hash Sum mismatch
@resmall
resmall / testing.php
Created December 9, 2015 16:24
Alguns scripts/snippets pra testes no Laravel.
public function test_atualizar_tarefa_from_user_panel() {
Session::start(); // Start a session
$this->patch('/projetos/1/tarefa/30', ['progresso' => 10, "_token" => csrf_token()], ['HTTP_REFERER' => 'http://localhost/usuarios/1/tarefa/30/edit']);
$this->assertResponseStatus(302);
$this->assertRedirectedToRoute('usuarios.tarefa.index', [1]);
}
// Metodo 2 sem desabilitar middleware
Session::start(); // Start a session
$response = $this->call('PATCH', '/projetos/1/tarefa/30', array("progresso" => "10", "_token" => csrf_token()), [], [], ['HTTP_REFERER' => 'http://localhost/usuarios/1/tarefa/30/edit']);
@resmall
resmall / README.md
Created December 2, 2015 13:42 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@resmall
resmall / 0_reuse_code.js
Created October 21, 2015 15:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@resmall
resmall / gist:51b328aa303b15979e77
Last active October 15, 2022 22:14
Imports an sql file and execute the script in Laravel Seeder
public function run() {
DB::unprepared(File::get('path/to/SQL/file'));
}
@resmall
resmall / switchArrayIndex.php
Last active October 21, 2015 16:44
In an array of arrays, switches the key for a sub-array element value
function switchKey($array, $newKey) {
$newarray = array();
foreach($array as $subarray) {
$newarray[$subarray[$newKey]] = $subarray;
}
unset($array);
return $newarray;
}