Skip to content

Instantly share code, notes, and snippets.

View devdrops's full-sized avatar
🔥
Paz Entre Nós, Guerra Aos Senhores

Davi Marcondes Moreira devdrops

🔥
Paz Entre Nós, Guerra Aos Senhores
View GitHub Profile
@devdrops
devdrops / code.md
Created April 28, 2016 14:59
Russian Roulette in terminal

Russian Roulette in terminal

[ $[ $RANDOM % 6 ] = 0 ] && echo "You're dead." || echo "Click"
@devdrops
devdrops / instructions.md
Created May 19, 2016 13:30
CONFIGURE XDEBUG ON VAGRANT BOX

CONFIGURE XDEBUG ON VAGRANT BOX

Tired of editing config files every goddam time after vagrant destroy? I've got you covered :D

  1. Find where the xdebug.so file is. Store this value in a variable.

    EXT_PATH=$(sudo find / -name xdebug.so)
@devdrops
devdrops / examples.md
Created May 24, 2016 17:45
Progress bar in bash: examples

Progress bar in bash: examples

#!/bin/bash

i=0
while ((i < 101)); do
  printf "\r%3d%% loaded..." $i
  ((i += 1))
 # Of course, in real life, we'd be getting i from somewhere meaningful.
@devdrops
devdrops / Stop_build_if_PR.sh
Created May 26, 2016 11:40 — forked from jcouyang/Stop_build_if_PR.sh
make Bamboo support Github Pull Request with Status API
#!/bin/bash
if [[ -n ${bamboo_pull_num} ]]; then
echo 'stoping bamboo'
curl "http://${bamboo_BAMBOO_USER}:${bamboo_BAMBOO_password}@your.bamboo.domain/build/admin/stopPlan.action?${bamboo.planResultKey}-${bamboo.buildNumber}"
fi
@devdrops
devdrops / gist:05e1c921b2fb3b26428d21e7cc2aa0b0
Created May 31, 2016 18:16 — forked from javiereguiluz/gist:a66f084a4f2cf11cf0ee
Discussion about the different solutions to display a flash message

The problem to solve

We want to show a flash message as the result of executing some controller. This message will only last for the next request.

Proposed Solution #1

I propose to use the new addFlash() method available in the base controller of Symfony 2.6:

@devdrops
devdrops / HomeRedirect.php
Last active June 15, 2016 23:12
Symfony 2.7, PHPUnit and a Listener with RedirectResponse
<?php
namespace My\Awesome\Namespace;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
class HomeRedirect
{
/**
@devdrops
devdrops / about.md
Last active August 30, 2016 20:36
JSONView Custom CSS Themes
@devdrops
devdrops / steps.md
Last active September 22, 2017 14:09
PHPBrew on Ubuntu 14.04

PHPBrew on Ubuntu 14.04

Steps:

  1. Installing
    curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
    chmod +x phpbrew
    sudo mv phpbrew /usr/bin/phpbrew
    
@devdrops
devdrops / steps.md
Last active July 27, 2016 17:29
Docker on Mac

Docker on Mac: Steps

Installing your first Environment

Let's assume that you're starting with a Dockerfile - and the bravery to start.

Mac/Windows requires that Docker runs from a VM (:cry:), so the best approach is using Docker Toolbox.

  1. Install Docker Toolbox (download it, then click next till the end of the world);
  2. docker-machine create --driver virtualbox AWESOME_VM to create a new environment. You can name it the way you like 😉.
@devdrops
devdrops / checklist.md
Last active January 31, 2018 15:45
Development Setup Checklist