TDD - Hands On

About ten days ago, at the PHP Unconference I presented “TDD - Hands On”. Video is available here: Read more »

Removing git references to unexisting remote branches

Sometimes you remove a branch via web (github, gitlab…) but you still have its reference when you run: $ git branch -a remotes/origin/featur-cool-feature-we-are-working-right-now remotes/origin/feature-removed-long-ago # This guy is about to... Read more »

Resolving github token issue in composer

TLDR; Visit your github personal tokens page, create a new token and use it in the following command: composer config -g github-oauth.github.com <oauthtoken> You can read this article to understand... Read more »

Setting up Sendmail on Fedora

TLDR; This is the TLDR version. sudo yum install sendmail sudo make all -C /etc/mail/ sudo service sendmail start Testing: echo "Subject: test" | /usr/sbin/sendmail -v my@email.com The long version... Read more »

Command Buses are awesome

I’m not sure if that is really a design pattern. But I find that simple and it helps to make code intent very clear. It goes along with DDD principles.... Read more »

Using Git as a SVN client

So you are stuck with SVN, huh? So here is what you will do: git svn clone -s --prefix=origin/ https://svn.url/projects/{my_project} This assumes that you have {my_project}/trunk, {my_project}/tags and {my_project}/branches Work... Read more »

Using VIM as a PHP IDE

EDIT: you can watch a video based on this post here On this post I will try to share my vim adventure for the last 2 years. I’ve been using... Read more »

How to create and apply patches with git

This is how I created a patch with the diffs I wanted to apply: git diff HEAD branch-whose-changes-i-want-to-aply > /tmp/diff.patch And here is how to apply; git apply /tmp/patch.diff Resolving... Read more »

How to suppress specific PHPMD warnings

I was struggling to find the specific types of warnings to suppress. So here is a list of Warnings that can be suppressed: Unused code: UnusedPrivateField UnusedLocalVariable UnusedPrivateMethod UnusedFormalParameter Naming:... Read more »

Using Xdebug inside vim

Install vdebug. Configure xdebug and restart your php-fpm and apache/nginx. Here is the configuration I used. They can be found in the php.ini or in a aditional ini file, which... Read more »

Saving sessions on vim

You can save the session by doing this: :mksession ~/.yesterday.vim Then tomorrow you can source that vim file and you’ll have your old session back: :source ~/.yesterday.vim Alternatively you can... Read more »

Downloading all files from a folder with wget

So you want to download all those [your favorite tv show here] videos from that nice index page. Here’s what you do: wget -c -r –no-directories –no-parent http://somewebsite.com/some-folder -c –... Read more »