Skip to content

Instantly share code, notes, and snippets.

View jleonardolemos's full-sized avatar

Leonardo Lemos jleonardolemos

View GitHub Profile
@jleonardolemos
jleonardolemos / php_metrics_checker
Created August 28, 2020 21:17
php metrics checker over json output
#!/usr/bin/env php
<?php
/**
* check for metrics on jenkins
* pass -d param with the path of phpmetrics output json
*/
function getHigherMetric($metrics, $value)
{
$mappedMetrics = array_map(function ($metric) use ($value) {
@jleonardolemos
jleonardolemos / keybindings.json
Last active June 4, 2020 15:37
vscode keybindings
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "ctrl+shift+g",
"command": "-workbench.view.scm"
},
{
"key": "ctrl+shift+g",
"command": "workbench.view.scm"
},
@jleonardolemos
jleonardolemos / .php_cs
Created September 10, 2019 17:25
php cs fixer file
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('somedir')
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
->in(__DIR__);
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true
@jleonardolemos
jleonardolemos / vscode-extensions.txt
Last active October 4, 2019 21:31
vs code extensions
#code --list-extensions | xargs -L 1 echo code --install-extension
code --install-extension bmewburn.vscode-intelephense-client
code --install-extension donjayamanne.githistory
code --install-extension eamodio.gitlens
code --install-extension emeraldwalk.RunOnSave
code --install-extension Equinusocio.vsc-material-theme
code --install-extension GrapeCity.gc-excelviewer
code --install-extension Gruntfuggly.todo-tree
code --install-extension higoka.php-cs-fixer
code --install-extension kumar-harsh.graphql-for-vscode
# get all project conteiners up
alias ddown='docker-compose down'
# get all project conteiners up
alias dup='docker-compose up -d'
# get all project conteiners up
alias lddown='cd ~/code/laradock && docker-compose down'
# get laradock default containers up
alias ldup='cd ~/code/laradock && docker-compose up -d nginx mysql phpmyadmin'
alias vup='cd ~/Homestead && vagrant up'
@jleonardolemos
jleonardolemos / coverage_for_dusk.php
Created March 31, 2018 23:58
generating code coverage for Laravel Dusk tests
<?php
/**
* This is a tool for help coverage generation on Dusk
* This was based on this article: http://tarunlalwani.com/post/php-code-coverage-web-selenium/
*1. add this file to your laravel tests directory
*2. add the following line to your nginx config:
* fastcgi_param PHP_VALUE "auto_prepend_file=\"/absolute_path/tests/coverage_for_dusk.php\"";
* if you are using apache you can use this line on .htaccess:
* php_value auto_prepend_file "/absolute_path/tests/coverage_for_dusk.php"
*3. Sample test:
@jleonardolemos
jleonardolemos / settings.json
Last active October 4, 2019 21:33
my vscode configs
{
"workbench.iconTheme": "material-icon-theme",
"editor.fontSize": 20,
"workbench.colorTheme": "Material Theme Darker",
"workbench.activityBar.visible": false,
"workbench.statusBar.visible": false,
"breadcrumbs.enabled": true,
"workbench.editor.highlightModifiedTabs": true,
"debug.console.fontSize": 20,
"terminal.integrated.fontSize": 20,
@jleonardolemos
jleonardolemos / launch.json
Created February 11, 2018 19:44
config sample for PHP debug extension of vscode
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/home/vagrant/code/projectname": "/home/leonardo/code/projectname",
@jleonardolemos
jleonardolemos / stack.go
Created December 20, 2017 16:54
A simple stack implementation in golang
package collections
import "errors"
type Stack struct {
valores []interface{}
}
func (stack *Stack) Push (valor interface{}) {
stack.valores = append(stack.valores, valor)
@jleonardolemos
jleonardolemos / quicksort.go
Created November 28, 2017 11:33
quicksort recursive script
package main
import "fmt"
import "os"
import "strconv"
func main(){
entrada := os.Args[1:]
numeros := make([]int, len(entrada))