Generate a random email address in TextExpander with Applescript

Since my last post about generating random email addresses in TextExpander, I’ve move from using Ruby to Applescript to do so. Here is my script which essentially does the same thing.


From West to East

More and more people in the Philippines are trying to live like people in the West. I was surprised to see a lot of people taking up hobbies such as jogging and cycling as well as something I had never seen there before, people walking their dogs. The main things I was aware of though was the shift towards a more Western diet.

Ever since I was young my height meant I stuck out when we would go home to the Philippines, but while there last year (2014) many of the younger generation were very close to my own height. Surprisingly a lot were very fat, if not obese too. There have always been fat people in the Philippines, but it is definitely one step up the scale now. In all the times I have been there previously I don’t think I have ever seen an obese Filipino, but this time I saw quite a few. I can only guess this is down to shifting diet habits.

People are eating a lot more processed foods there now as opposed to home cooked meals. Whether that is the real reason or not for these changes, I cannot say.  Whatever it is though, is not for the good. It makes me think of the great phrase “Overfed and under-nourished”. Already the ailments such as obesity are apparent, and only time will tell if more western health problems arise as well.

Gazing into an endless pool

Reflecting on things is an important counter balance to taking action. It is important to understanding why we do or did things, as well as the consequences they might have in the future. It is easy to fall into the trap of over-reflecting, just as easy as it is to over-act. I definitely fall into the former camp. I spend too much time reflecting on what I have, or have not done, as well as what I want to do in the future. As a result I don’t get enough done and end up paralysed in thought. It’s a vicious circle, as the more you reflect, the less you get done and the less you get done the more you reflect on why you haven’t got things done.

It’s easy to know you need to take action but difficult to actually do. Being self-aware of these issues is the main start to overcoming them. Often times when you catch yourself not doing anything, even just phrasing your thoughts can lead to better outcomes. Instead of thinking “Why can’t I get this task done?”, a better question might be “What would be the least I can do right now to make a start?”. As well as how you break down tasks. A todo list with an item such as “Build new feature X” would be better replaced with an item like “Spend 1 hour on feature X”.

Life is an endless pool that we could spend forever gazing into, looking for answers. But the truth is that all the answers we seek are not there. They are everywhere, all around us, waiting to be found.

Using Typeahead.js without Bloodhound

A great library for adding typeahead support to your site is Twitter’s Typeahead.js. Even better is the excellent Bloodhound suggestion engine which comes with it. Sometimes though if you’re dealing with a remote suggestion engine like Elasticsearch’s completion suggester you don’t need to run remote results once again through another suggestion engine. Bypassing Bloodhound is as simple as hooking your own source function into your Typeahead definition.


What is street photography

Street photography is perhaps one of the most difficult genres to nail down. Wikipedia defines it as:

Street photography is photography that features the human condition within public places. Street photography does not necessitate the presence of a street or even the urban environment. Though people usually feature directly, street photography might be absent of people and can be an object or environment where the image projects a decidedly human character in facsimile or aesthetic.

What does that exactly mean? I spend a lot of time on the street photography subreddit and the submissions amaze me to no end, because they fall so far of the mark of what I consider a street photograph to be. My suspicion is that many take the name “street photography” in a literal sense that it’s a photo taken on the street.

The way I think of street photography is that in essence it has that “a-ha” moment. That striking instant that makes you question and want to know more about what’s happening in the photo. On the surface they appear to be photos of people going about their daily lives, but they tell a deeper story. Perhaps through juxtaposition or even just by being they way they are which might be out of the ordinary.

Naming service classes in Rails

One of the core ideas of Rails is convention over configurations. Models go in app/models, controllers go in app/controllers and views go in app/views. The danger is that we stick to those conventions no matter what and we end up either with fat controllers, fat models or even worse a mixture of both.

Many times we don’t take enough advantage of Ruby’s object oriented nature and the ability to extract functionality out into separate classes. Doing so can make an entire application easier to extend, understand and test. I have tried approaching this from different angles in different projects and I’ve found that the two main hurdles to getting this right are naming classes and putting them in the right place.

I have experimented with naming such as UserAuthenticator and UserAuthenticationService, and always end up feeling uncomfortable I constantly wonder if the other name is better or if there is a better way entirely. Using agent nouns in class names is considered a code smell, but the more that I think about it the important part is picking a choice and sticking to it. I was looking at the GitLab repository and noticed that they’ve done exactly that, everything is named in a consistent manner. I think many may dislike that but it makes things extremely clear and easier for anyone contributing as to what they should name their classes and where they should put them.

Will VC eat itself

There was a post on TechCrunch a few days ago about the big lie in startups and how you can’t run a startup without lying about a million things. When I really think about all these funded startups it upsets me, mainly because I’ve tried to bootstrap all my endeavours. That does make me sound bitter, and I am if I’m honest about it. If you start a company, get funding and fail you’re still often seen as a winner in people’s eyes where as those that bootstrap a company and fail are just seeing as losers. When did we reach a point where getting VC was the main priority after starting a business? When did we lose sight of actually trying to make money first?

Nginx proxy_pass a folder to WordPress

After a rash of security updates for WordPress, I finally buckled down to move our install of WordPress off to it’s own server. This would be easy if we were running the blog on it’s own domain, but it was actually living under /blog on our main domain for SEO reasons. Running nginx as a reverse proxy to WordPress on a different machine was not an easy task. A lot of guides did not seem to have the information I needed so here are the steps I took to get it working.

Add the proxy_pass definition to your nginx config:

Update your WordPress settings. This is the key to getting your site to work correctly. Leave the WordPress Address as where the site is hosted, but change the Site Address to be where URLs are to be written as linking to

Screenshot 2015-07-27 21.43.38

I also had to add a rewrite to my .htaccess file to remove trailing slashes:

Be warned that the permalinks section will suggest a .htaccess file which has /blog/ as the RewriteBase, but this just sends things into a redirect loop. Leave it as the standard root setting.

Make sure you also check that the canonical tags generated by your theme are correct. You want to be sure that any references on the WordPress Address URL canonicalise to Site Address URLs.

Business Design Principles

Facebook’s Four Business Design Principles is an excellent reference that should be at the core of every business tool.

Help people learn and grow

Balance efficiency and effectiveness

Bring clarity to complexity

Be accurate and predictable

The majority of my time these days is spent writing tools for business as opposed to consumer facing sites and trying to find the balance between ease of use and providing all the elements necessary to complete a task can be very difficult at times. I had not heard of the Goldilocks Principal before but it perfectly summarises this fine balancing act.

With a complex piece of UI, if you don’t simplify it enough, people can’t figure out how to use it. But if you swing too far in the other direction and over-simplify it, you risk dismantling the very value that people are looking to access through the tool.

When immersed in a tool it’s easy to become blind to the experience of actually using it. A good example are the drop down menus on a site I’ve been working on these past few years. Even though we would all use them day to day they were never really given a second thought. It was only after looking into how they were actually performing that it was apparent that they were actually really awful to use. Our own familiarity had caused a massive disconnect between how effective they were to use.

Cutting out fizzy drinks

For as long as I can remember I have been drinking fizzy drinks. My mum and my aunt love to tell the story of them giving me Coke when I was just a baby. I spent most of my teenage years drinking several cans of Coke a day and then most of my adult life drinking diet versions. It wasn’t uncommon for me to drink six or more cans a day. At various times I have tried to cut back, promising myself that I would just have a can at lunch or at dinner, but all too often I would just end up sneaking more in between meals.

Earlier this week though I ran out and decided not to go and buy any more or add it to our shopping for the week. These past few days are the longest I have gone without a fizzy drink in probably the last 15 or more years. I can’t say I feel any affects from doing so, but I wouldn’t expect to feel the benefits, if any, for a couple of weeks at least. While I think there are definite health implications from the sugar in Coke, the jury does seem out on artificially sweetened versions.  It doesn’t take long to come across a million articles saying it’s cancer causing, but then studies say it’s safe. I don’t believe that it has big health implications but by the same token I don’t believe that it can be beneficial if you’re trying to lead a healthy lifestyle.