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 / branch.sh
Created November 18, 2016 22:05
Git: checkout all remote branches locally
#!/bin/bash
# First things first
current=`git branch | grep \* | cut -d ' ' -f2`
git fetch --all
# Once we know all the remote branches
remoteprefix='remotes/'
branchprefix='remotes/origin/'
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
@devdrops
devdrops / instructions.md
Last active November 14, 2016 16:45
Git: ignore ^M and other nasty line-ending chars

Git: ignore ^M and other nasty line-ending chars

git config --global core.whitespace cr-at-eol
git config --global core.autocrlf true
@devdrops
devdrops / instructions.md
Created October 18, 2016 15:49
grep: limit char length
@devdrops
devdrops / instructions.md
Created October 5, 2016 21:54
Git hook to include the branch name on each commit

Git hook to include the branch name on each commit

Tired to forget to write every goddam time the branch name on the commit messsage? This got you covered:

  1. Add the prepare-commit-msg file to your .git/hooks/ folder;
  2. Then, chmod +x prepare-commit-msg;
  3. PROFIT!
@devdrops
devdrops / Helper.php
Created October 4, 2016 18:08
JSON helper for PHP
<?php
namespace \Json
class Helper
{
/**
* @var array
*/
protected $errorReference = [
@devdrops
devdrops / docker-compose.yml
Last active October 17, 2016 20:46
WIP for a new Docker environment
version: '2'
services:
nginx:
image: nginx:latest
ports:
- "777:80"
networks:
- main
@devdrops
devdrops / instructions.md
Created September 15, 2016 17:54
Squash several commits into one
@devdrops
devdrops / db-open
Created September 13, 2016 20:43 — forked from helderco/db-open
Script to open a mysql database in Sequel Pro from a service in docker-compose.
#!/bin/bash
set -e
show_help() {
cat << EOF
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE]
${0##*/} -h
Open a standard connection in Sequel PRO.
@devdrops
devdrops / example.md
Created August 12, 2016 17:07
Moar testsuites on PHPUnit file

Moar testsuites on PHPUnit file

<?xml version="1.0" encoding="UTF-8"?>

<!-- http://phpunit.de/manual/4.1/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
         backupGlobals="false"
         colors="true"
@devdrops
devdrops / tip.md
Created August 11, 2016 13:22
Restart PHP-FPM on Mac

Restart PHP-FPM on Mac

as found on StackOverflow

And this command to restart my php-fpm:

brew services restart php56