Report inadequate content

Development in Harecoded

1/10/2014

Merging two, three or more git repositories keeping the log history

If you ask anyone, merging several git repositories into a single one would usually be considered a bad strategy: as a rule of thumb, your code base should have several components isolated and then use a dependency manager (e.g: Composer) to bring them together.

Nevertheless, there are always many different scenarios and with them come different use cases, weird situations...

19/09/2014

Terminal tuning for Git developers in Mac

If you work with Git in the terminal there are some tweaks you might want to apply to your prompt for safer and faster coding. The following lines are part of my ~/.bash_profile file. I use it on Mac although that might work in Linux as well.

You can copy and paste this code in your ~/.bash_profile (create it if it doesn't exist), save and open a new terminal to see the...

10/12/2013

Organizing git branches in logical folders

It is easier to find things when they are well organized. If you are a git user a good practice to name the branches would be to use descriptive names including slashes "/" (as in paths) where everything before the slash is the folder you want to use and then the logical name after it.

If you use the fantastic git graphical interface SourceTree (free for Windows and Mac)...

6/12/2013

Automatically archive S3 backups to Amazon Glacier

Amazon S3 is an on-cloud storage service used in a variety of scenarios. On of these common scenarios is the one where you upload your server backups to S3 using any of the multiple convenient libraries and tools. 

In the other hand, Amazon offers another service more oriented to data archiving and backup named Amazon Glacier. If you store a lot of data (and I am not ...

23/11/2013

Kill processes using string search

A lot of Linux distributions (and Mac) come with a handy command named pkill installed by default. This command is very useful to kill processes in a more natural way.

Instead of doing a kill/killall based on the ID of the process or the binary name, you can just pass a string that appears in any part of the process list, including the parameters you used to start a...

8/08/2013

A true multiline regexp in PHP. The "I miss U" technique

The following regular expression matches tags that are opened and close in different lines, albeit can be used for any other purpose. It is also ungreedy, meaning that when the first closing tag is found the rest of equal tags will be ignored.

It is very easy to remember and to apply, I call it the "I MISS YOU" technique, see the why in the regexp modifiers: ...

6/06/2013

Migrating a Github repo to Bitbucket (or similar services)

Github is awesome. Bitbucket is awesome too. They are both excellent services, but Bitbucket has a plus: it's free for private repos.

That's one of the reasons on why we decided to stop paying our $25/mo Github account for small projects and moved to Bitbucket. Although the Bitbucket guys have now a one-click "import from Github tool", the solution is so simple that I don't...

13/03/2013

Configure Compass,Sass,Less... in PHPStorm

PHPStorm 6 bundles a new feature called "File watchers" which enables Sass, LESS, SCSS, CoffeeScript, TypeScript transpilation. This option will compile your compass/scss/whatever files when the source file is saved (this is when you lose the focus or manually save).

So, for the basic stuff you can stop using external programs and watchers likeCodeKit or...

7/03/2013

Features in PHP 5.4

We had to create a file upload form that allows a user to upload big files. In order to keep a good experience for the user we decided to show the progress bars.

There are several ways of doing that but it came to my mind that PHP 5.4 had an improvement on file upload, making it easier now and wondered if I had the last excuse to upgrade the servers from 5.3 to 5.4.

...