Tools of the trade

This is a quick update of the tools I used these days. I am a web user interface developer now so some of these tools might be kinda niche!

  • Text editor: SublimeText 2, because it loads fast and I swear by its open by file name feature
  • Computer: MacBook Air 13″, a decent screen size with good portability. I like working at cafés and this gadget fits my lifestyle.
  • Browser: Chrome 25. I lost track of Chrome’s version, comes with Chrome is the excellent debugger I cannot live without.
  • CSS generator: Less, because Less can be compiled by JavaScript on the client side. It’s easy to get started developing.
  • Revision control: Git or SVN. My vote is to Git but my company is on SVN.
  • Image editor: Photoshop. We use Photoshop for general slicing.
  • Programming and markup languages: Mainly JavaScript, HTML and CSS. We have quite a bit of Handlebars.js stuff as well. We use JavaScript extensively these days.
  • JavaScript framework: Backbone.js and Marionette.
  • Web server: Apache Tomcat. We have a Java stack.
  • Page profiling: Just Chrome.
  • Automation: Ruby Guard and Grunt.js. There’s a bit of LiveReload as well, but only when I develop on a Mac.
  • Quality checks: JShint and Chrome Audit in the console.

I can see what I use previously as a more general web developer.

Saving Resque

Open source project Resque needs some volunteers:

Rescuing Resque: Let’s do this

Anyway, Resque has been psuedo-abandonware for a while now. In January, Terence Lee from Heroku got in charge of the project, but it’s a big job. Too big of a job to properly manage alone. It’s hard to sift through 60 pulls and 120 open issues, some of which have been open for a few years. And manage the 1.x line while working on new stuff for 2.0. And debug issues that basically boil down to “When I upgrade Resque and this random gem, everything breaks, but when I downgrade that other gem, it works again. But Resque throws the error.”

So Terrence gave a presentation at Frozen Rails, and in it, he outlined what needs to be done for Resque 2.0, and asked for some help getting it out the door. So myself and a few other people are gonna pitch in and help out, and we’d love to have you.

Resque is a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later. You can contribute through GitHub.

Set upstream master in Git

If you wish to set tracking information for this branch you can do so with:

[code language=”bash”]git branch –set-upstream master origin/<branch>[/code]

Where could be master.

An example would be:

[code language=”bash”]git branch –set-upstream master origin/master[/code]

With this, you can just do a git pull and git push without having the branch specified.

Never type origin master again

The reality with most projects is I typically work with origin master only. Only 10% of my projects is doing actual branching. (Yea, there probably should be an improvement on that figure.)

Here’s how to merge origin master by default.

[code lang=”bash”]git config branch.master.remote origin
git config branch.master.merge refs/heads/master[/code]

You never have to see the following message again:

[code lang=”bash”]kahwee-mba:gladlycode.com kahwee$ git pull
You asked me to pull without telling me which branch you
want to merge with, and ‘branch.master.merge’ in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. ‘git pull ‘).
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch “master”]
remote =
merge =

See git-config(1) for details.[/code]

Tools of the trade

Every web developer uses his/her set of preferred tools. Here’s mine:

  • Text editor: SublimeText 2, because it loads fast and I swear by its open by file name feature
  • Computer: MacBook Air 13″, a decent screen size with good portability. I like working at cafés and this gadget fits my lifestyle.
  • Browser: Chrome 18 or 19. I lost track of Chrome’s version, comes with Chrome is the excellent debugger I cannot live without.
  • CSS generator: Less, because Less can be compiled by JavaScript on the client side. It’s easy to get started developing.
  • Database engine: MySQL InnoDB.
  • Database browser: Sequel Pro, never found a replacement for this. I’ve been using this for 3 years, by far the best.
  • Revision control: Git or SVN. My vote is to Git but my company is still on SVN.
  • Image editor: Photoshop. Embarrassingly I am one of those that will just launch Photoshop to make PNGs with alpha-transparency. There are probably better tools out there but I can’t get used to them.
  • Programming languages: PHP for web development. JavaScript or Ruby on scripting automation. I still use Expect for a bunch of server-side tasks, I cannot move away from that still.
  • Web server: Apache for development. It’s all because of PHP’s xdebug. My colleagues use .htaccess often too. I use nginx for production usually.
  • Load profiling: Seige, it’s simple and reliable.

Other tools include:

  • LiveReload 2 has been extremely convenient and it has been part of my workflow for months. I never looked back.
  • Bash alias lets me quickly navigate through the trenches of my messy directories. I also use it to pull for Git quickly.

How to rename a tag in Git

Well, first of — you can’t. You have to map a new tag to the old one then delete the old tag. Let’s assume we currently have a tag called “old_tag” and we want to replace it with a tag named “new_tag”.

To link the new tag to the old one:

[code lang=”bash”]git tag new_tag old_tag[/code]

This creates a new_tag that references the commit made by old_tag.

Now we need know how to delete the old tag in Git.

[code lang=”bash”]git tag -d old_tag[/code]

Bye old_tag. Now the thing about git is it doesn’t let you delete the tag on the remote server just as a precaution. Now you can’t do something like “git push –tags origin master” to delete the tag from the remote server.

Here’s how to do it:

[code lang=”bash”]git push origin :refs/tags/old_tag[/code]

You need to explicitly state that you want that reference updated. This will delete the tag in the remote server.

One more example why SVN sucked

The worst part of SVN is that it’s got lots of .svn folders hidden in every single versioned directory. It has never occurred to me how terrible an idea this is until I delete a directory. I had this weird deja vu that I’m going to regret issuing that rm -rf command but I did so anyway. It’s versioned, I tell myself.

Ah, but there’s a catch

No. Once I did that I spend the next 30 minutes trying several commands to recover it, such as svn revert and svn update. They don’t work because the current directory’s .svn folder is still there and it’s just silly SVN’s way of knowing its there. Every command to revert led me, falsely, to believe my folders are all still there.

So I downloaded an entire new copy of the files I just deleted and put them back. That failed as the files I have restored manually don’t have the .svn folders. I tried committing the restored copies and the SVN server will just say the “Commit failed” with the reason “Server sent unexpected return value (405 Method Not Allowed) in response to MKCOL request for ‘…'”.

Don’t tell me what I can’t do!

Well… The thing is I wasn’t convinced. In an act of folly I deleted the parent directory which now resulted in the whole project just dead basically. Fantastic.

I should add that at this moment it all came back to me. I am certain this SHITuation happens to me at least a dozen time especially when I’m half awake.

As least Git doesn’t have that issue. Every time I use SVN, I have this feeling I’m walking on thin rope fearing to offend the Tiki gods. I guess I’m just not smart enough for SVN.

Some suggestions for .gitignore

This is more of a personal note. You may find it useful too.

Here’s how to ignore files and folders using Git. You can create a file “.gitignore” and place in the files and folders that you wish to ignore (separated with a line break).

In the file: “./.gitignore”

Here’s a list of standard things to do a .gitignore. It ignores the thumbnail files generated by Mac OSX and Windows. (I’m on Windows Vista.) You can place this on the top folder of your Git project:

[code lang=”ini”]nbproject
.DS_Store
Thumbs.db
Desktop.ini[/code]

“nbproject” is for NetBeans.

In the file: “./app/.gitignore”

Well, if you use CakePHP, you may want to add an additional .gitignore file in your CakePHP app directory:

[code lang=”ini”]tmp/**/*
config/database.php[/code]

I am open to suggestions what other files or folders are good to ignore but these are all I can recall. You can read more about gitignore at kernal.org.