This week I was trying to locate which files in the codebase use a specific class method while debugging some code. This method however has been used a lot, when I say a lot I mean 10 to 20 times per file, and in lots of templates. This is mainly because it is a template helper to generate complex links within the page. Anyway, a simple use of grep wasn’t all that much help, so I refreshed my memory on how to use sed to make the output a little more readable.
Have you ever wanted a magic 8ball to use at work? A real one, even though nice to have on your desk, is not always practical. When I had a real one on my desk people were forever playing with it when they came to talk to me.
Making one is very simple. All you need is an array of values to use as responses, and a way to pick one of them at random. I could have written this in any number of languages, but this one is written in bash for simplicity.
We’ve all been there, you’re working on a project with lots of externals and we see a lot of noise when you run svn status or svn st (depending on your preference). Most of the time we just filter that out, but I decided to string a few grep statements together to make the output that little bit nicer to read.
There are loads of little tips and tricks out there on how to make your svn operations a little easier. One which I found out recently was how to leverage bash’s brace expansion to reduce key strokes.
This powerful feature makes svn diff commands a lot easier.