Skip to content

Instantly share code, notes, and snippets.

Daniel Costa danielcosta

Block or report user

Report or block danielcosta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@danielcosta
danielcosta / lint-php.sh
Last active Jul 19, 2017
Lint changed PHP files
View lint-php.sh
#!/usr/bin/env bash
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
ANCESTOR=$(git merge-base $CURRENT_BRANCH master)
OIFS=$IFS
IFS=$'\n' FILES=($(git diff --name-status $ANCESTOR HEAD | grep -E '^[AM].+\.php$' | awk '{print $2}'))
IFS=$OIFS
php-lint.sh "${FILES[@]}"
@danielcosta
danielcosta / install-teamviewer.sh
Created Jul 10, 2017
Install Teamviewer on Debian
View install-teamviewer.sh
sudo dpkg --add-architecture i386
sudo apt update
cd ~/Downloads
curl -L -o teamviewer_i386.deb "https://download.teamviewer.com/download/teamviewer_i386.deb"
sudo apt install -y ./teamviewer_i386.deb
rm teamviewer_i386.deb
@danielcosta
danielcosta / updateJetbrains.sh
Last active Nov 2, 2018
Script to update PhpStorm and others Jetbrains products
View updateJetbrains.sh
#!/usr/bin/env bash
VERSION_PATTERN="([0-9]+\.[0-9]+\.[0-9]+)"
case "${1}" in
"phpstorm")
TOOL_NAME="PhpStorm"
INSTALL_DIR="/opt/phpstorm"
case "${2}" in
"eap")
@danielcosta
danielcosta / docker-compose.sh
Created Apr 7, 2017
Run docker-compose inside a container
View docker-compose.sh
#!/bin/bash
#
# Run docker-compose in a container
#
# This script will attempt to mirror the host paths by using volumes for the
# following paths:
# * $(pwd)
# * $(dirname $COMPOSE_FILE) if it's set
# * $HOME if it's set
#
@danielcosta
danielcosta / Dockerfile.php-5.5
Last active Apr 24, 2019
Compile memcache on alpine container for PHP 5.5 and 5.6
View Dockerfile.php-5.5
# php-5.5
FROM daccbr/php:5.5-fpm-alpine
RUN addgroup -g 1000 sumup && adduser -u 1000 -h /home/sumup -H -G sumup -s /bin/false -D sumup
RUN apk --update add openssh-client libtool make grep autoconf gcc libc-dev zlib-dev
RUN cd /tmp \
&& apk --update add cyrus-sasl-dev libmemcached-dev \
&& curl -L --progress-bar -o "php-memcached-2.2.0.tar.gz" "https://github.com/php-memcached-dev/php-memcached/archive/2.2.0.tar.gz" \
@danielcosta
danielcosta / ProtectedMethodTest.php
Created Sep 25, 2015
If you really need to test a protected class...
View ProtectedMethodTest.php
<?php
class ProtectedMethodTest extends PHPUnit_Framework_TestCase
{
public function testProtectedMethod()
{
$method = self::getMethod(
'MyClass',
'getProtectedMethodReturnsTrue'
);
View 01.phpize
2015-02-03 10:23:36 -0200
/usr/local/opt/php56/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
View pomodoro.sh
#!/bin/bash
# POMODORO
# usage: pomo | pomo short | pomo long
SLEEPTIME=1500
TITLE="POMODOR0 :)"
SUBTITLE="Take a Break :)"
if [ "$1" = "long" ]; then
@danielcosta
danielcosta / post-merge
Created Sep 17, 2014
post-merge hook for bob/alice (mobly)
View post-merge
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` or `git merge` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
View keybase.md

Keybase proof

I hereby claim:

  • I am danielcosta on github.
  • I am danielcosta (https://keybase.io/danielcosta) on keybase.
  • I have a public key ASDEDoD_51rq6giZ8gWsG1a5cKAehbzkMp93GyKUyteOsgo

To claim this, I am signing this object:

You can’t perform that action at this time.