Category Archives: tech
What Got You Involved in Open Source?
Colourless Git Output
Try putting the following into .git/config
:
[color] branch = false diff = false interactive = false status = false
I had expected to be able to set color.ui
to false but that didn’t seem to make much difference, so I now use the settings above. I thought I’d drop it here in case anyone else is looking for the same thing.
Easy Lint Check for JavaScript
Copy/Pasting and Vim
To paste between vim and something else, use the + (plus) buffer in vim. It contains the contents of your system clipboard, and you can also write to it. If you’re not already using buffers in vim, then you should probably read the excellent documentation but for a very quick start:
- To copy something into the buffer, select it in visual mode and type
"+y
- To paste from the buffer, type
"+P
I had no idea how I’d missed this really fundamental trick, so I thought I’d share!
Quick Switch Between Git Branches
git checkout [branchname]
However if you switch from one branch to another and want to switch back again (this happens when I’m reviewing changes and wondering if a bug is present on master as well), then you can do so by just doing:
git checkout -
Just a little timesaver in case it’s useful to anyone else – I know I’ve been using it quite a bit!
Wireshark Capture on Remote Server
To get an insight into the traffic going around the place, I’ve been using Wireshark and it’s ability to capture remotely, it’s really simple so I thought I’d write down my “recipe” on how to do this in case it’s useful. Continue reading
What Does URI Stand For?
Instead, the API publishes each record with a unique uri
field. If this record is referred to by another record, then this full identifier will be used in every case. If this record should be included in a collection, this exact same identifier will be used there, too. You can reach the resource directly by requesting its URI. In the same way that we might refer to a website by its URL, we refer to records in RESTful systems by their URI*. If you need to store these somewhere for your own use, you can use whatever key you like with the local storage, you may even choose to use the uri
field as it is unique.
* URI stands for Unique Resource Identifier
Getting Started with Beanstalkd
Why Beanstalkd?
My requirements were simply to add both asynchronous (for processing things like recalculating counts) and periodic (mostly for garbage collection) tasks to a PHP application. The application has a separate web application and backend API, both made of PHP’s Slim framework, and the API talks to MySQL. It’s all very lightweight and scalable, and I was looking for something to fit in with what we have, with good PHP support.
Enter beanstalkd, it’s a super-simple job queue and has great PHP support in the shape of Pheanstalk (I’m saving my PHP + beanstalkd examples for another day because this post would get too long to read otherwise!). I’ve used gearman in the past but beanstalkd seemed lighter, and when I started looking at their documentation I discovered that I had a working installation in about the time it would take me to fall off a log – which is always a good indicator of a tool that will be fun to work with :) Continue reading
Git Log All Branches
The remedy for this situation? The --all
switch to git log
. Continue reading