I have become quite serious about this whole Quantified Self movement. I guess as a developer it is easy to be caught up in that. And I have in large periods of time use RescueTime to monitor myself, but at times used more time analyzing the rescuetime data, than I saved from selfmonitoring. (I actually had to set up rescuetime as unproductive in rescuetime).
My blog is completely static - and even though I used to use jekyll, and have my blog hosted on github pages - I changed my setup to use middleman instead. The reasons for that are many, but my primary concern was that it seemed very rails like - and jekyll did not.
My blogposts are written in markdown - using terminal vim as my editor. Each kind of task I work on occassionally have been created as an activity in Concentrate. I have hooked my concentrate app up to alfred - and thus I can start an activity easily directly from alfred. This enables me to reduce all distractions, and open everything I need to perform the task.
Back in march I wrote about how I fought procrastination with my hosts file hack. I have since then abandonned this practice, but bad habits die slowly - and I sometimes need to educate myself a bit. I have had a license for the Concentrate app for years now - and I decided to use that this time around.
As always I managed to start procrastining by coding. Today because I needed - or at least decided I needed - a way to start/stop specific tasks (activities in Concentrate terms) with the help of Alfred.
The solution was three fold. First i needed to get the activities from concentrate (to ensure the list not be hardcoded), I needed a way to filter the list of available tasks from alfred, and finally I needed to start/stop concentrate from alfred with the given activity name.
Sometimes you quickly want to parse some json from an api. What I usually do, is write a quick ruby script and pipe curl output into that.
I have - for example - a list of books that I own and plan to read. About 20 percent of the books are actually books I have read before, but have planned to reread. I have made a list of the books in a simple json format (for a project which you may hear more about later).
If you want to customize your zsh experience (and you have oh-my-zsh installed), you should know how to extend your shell with custom functions.
First you need to create a plugin in ~/.oh-my-zsh/plugins/yourplugin/yourplugin.plugin.zsh - and include the plugin in the list of installed plugins in ~/.zshrc
There are a lot of ready made themes for oh-my-zsh users. You can even get a screenshot of each of the themes from a shared dropbox folder. So why would you ever need to know how to make your own theme?
Recently Simon Hørup Eskildsen posted a tweet or two about his new hostfile setup. The tweets were following by him posting his hosts-file as a gist. At work Jesper Rasmussen took the idea and solved it a bit smarter - so that you can have your pie and eat it too. (You can have host-file mappings, without the need to maintain them in two files).
The solution is quite simple. You have your regular hosts file, containing the usual mapping of domains to (quite possibly) localhost. Then you have one hosts file containing all the remapping of services, that you need to abstain yourself from using. Two small scripts either copy the original hosts file, and concats the focus files to them, or just symlinks the original hosts file. This way, any changes to the hosts file is always included.
Usually when I code, I use only terminal tools. This usually means that each project has its own tmux-session and that I use vim as my editor there. I manage my projects with tmuxinator, and have previously blogged about how I use little mapping in zsh to get autocomletion for projects.
How much you should batch together, and how long you should wait between batches depends on your use case. Both the amount of work to be done, and how dynamic your UI is (e.g. eventhandlers and animations) will influence how you solve this problem.
In The Clean Coder: A Code of Conduct for Professional Programmers (Robert C. Martin Series) Uncle Bob writes about the importance of doing deliberate practice. One of his methods is to do a Code Kata in the beginning of the work day, and one at the end.
I while back I posted a couple of my zsh snippets for working with git. Today however I read about a post about how to keep your feature branch up to date. I liked the little snippet, however we do not always use the master branch as the basis for feature branches. And we do not always use origin as the name for our remote. And on top of that, we do not always merge from the main branch, sometimes we rebase it - so that our feature branch is placed on the head of the branch it was based on.
Their solution based on canvas, and I was intrigued. I have not looked into canvas (or any other browser based graphics/animation) in quite some while, and wondered how the state of were at the moment.
And I must say, a lot have changed in the last few years. To challenge my self to do something "real" with the canvas tag, I decided to take CreateJs for a spin. I quickly decided that the project should be very small, and that I would have to complete it in about an hour.
I am a bit weird with my editor choice. I use three different text/code editors. I usually use PhpStorm for large projects in PHP, since the more intelligent code completion is a time saver for large changes in PHP, when the codebase is 248753 lines of PHP code. But for everything else including minor bugfixes and features I use either Sublime Text 2 or vim.
When writing code in vim, I usually open a complete project in tmux and have a lot of panes, one with vim, one with a terminal, one watching changes (through either grunt or yeoman for instance), one logged in to the db, one starting a server, and perhaps several panes connected to the production environment via ssh.
At Arnsbo Media we usually create a new branch when working on an issue from Jira. And we name the branch after the issue id, meaning that the branch, is always prefixed with the issue id from Jira, and then some meaningful name after that.
This makes it easy to identify which issue a branch relates to. However to make issues auto update with code changes, and to make our automatic deploy mail a meaningful message to Product Owners with a link to the deployed issue, we need to make all relevant commits reference the issue id as well.
At Arnsbo Media we use FLOW3 for several projects. For most of those we use New Relic for application monitoring. This enables gives us great introspection in to the performance and errors on each application.
However using this with a PHP Framework that is not natively supported all requests show up in New Relic as index.php - which is not very convenient for performance tuning or bug squashing.
I have created a quick little implementation of a package with an aspect that weaves into each controllers processRequest method. This method has access to the request object, and thus will be able to extract relevant information about either the url used, or the combination of controller and action name.
Several years ago I read Steve McConnell's awesome book Code Complete: A Practical Handbook of Software Construction, Second Edition. Chapter 8 of the book is about defensive programming strategies, and one of those is to use assertions to ensure that variables and parameters match the assumptions we have about the input, and to throw an exception (or fail in some other way) when that is not the case.
About an hour ago I found a like (probably on hacker news or twitter) to yet another Sinatra like node library called Berliner. I have played around with it since then, and I find it awesome. It is very easy to understand, easy to use, and has all the best features from Sinatra, without copying each and every feature.
I use both vim and Sublime Text (with vintage mode). For most projects I have a sublime-project file.
If you want to learn how to do very advanced stuff in sublime text, you should take a look at the settings files for it, and try to learn something new from that.
One very awesome thing that I use a lot, is to create scoped keybindings that insert a specific snippet, or do some specific action depending on the current file.
One example is that I want ctrl+command+L to insert a link in a file, however how that link is inserted differs on file type, and context (is something currently selected or not).
At work we currently have two FLOW3 based projects, and both of them have a lot of packages. I have been in need of a sort of package management like Composer or npm for FLOW3 - but it seems not to be ready yet. I needed something easy to implement, and easy to manage - with as few dependencies as possible.
However one of the commenters mentioned that you could use JSON.parse and JSON.stringify in combination to clone an object. And indeed that works just fine.
A little while back my go to dns host gratisdns.dk had a sale of .eu domains (about a dollar each), and I may have bought a couple more than I knew what to do with. However one of the domains I bought actually gave me an idea. I bought the domain showmethecodes.eu, because of a joke I made with one of my colleagues while attending a conference. Any time someone had a talk and mentioned something they were good at, I always mumbled "show me the codes" - a reference to Linus message Talk is cheap. Show me the code
For a couple of weeks now my basic workflow consists mostly of terminal programs. Thus I now use iTerm2, tmux, zsh and vim for (almost) everything. However I found myself doing much of the same things, and today I realized what i needed.
My workflow when using git has some things I do a lot. Most times I hack away on some code, and then at some point want to create separate commits of what I have been doing.