All posts tagged: programming

Adding a custom Spree payment Gateway outside a Rails Engine

computing / programming / rails / spree

Adding a new Payment Gateway to Spree through a Rails Engine is pretty straight forward as you can hook in your new gateway after the initial payment gateway array has been created. This is how the spree_gateway gem does it: [crayon-5f7056c410269646977073/] If you want to do the same thing for your own project contained gateway it’s a little different. If you try to just directly edit the payment_methods array in an initializer it will get […]

Accessing values in your plist file from your iPhone/iPad app

computing / programming

Recently I’ve been coding some iPhone and iPad apps with multiple targets, all sharing the same codebase. Previously I had been using Preprocessor Macros to get the job done, but that soon turns messy and hard to maintain. I’ve since moved to just storing target specific values in each apps related plist file. Retrieving a value is as simple as: [crayon-5f7056c417bda411605980/]

Why Code Quality Matters

programming

Recently the discussion of code quality has come up with a couple of different people. With the main question: “If the app does what it’s supposed to do, why does code quality matter?” In one instance an application that was bringing in over a £1m in revenues a month had one of the worst code bases a friend had ever seen. And I totally agree that there is no correlation between code quality and the […]

Broken Window Policy of Programming

programming

There comes a point in every software projects life where everything just feels wrong. No one wants to touch the code as it stinks and everyone working on the project just feels demotivated and would rather just go home then have to do anything more on it. On projects like this, when it comes to adding new features or bits of code, because everything else is such a mess, the changes are just hacked in […]

Essential reading for developers

computing / programming

I’ve been meaning to write up a list of what books I think every developer, aspiring or seasoned should read. So let’s cut to the chase, and in no particular order: Code Complete If there was ever a bible for coding, this is it. It’s even Bible sized. A nice size to chuck at those annoying developers who just have no clue. Clean Code I would consider this book the “Ten Commandments” of coding and […]

Don’t use PHPMyAdmin. SSH tunnel instead.

computing

If you’re still using phpMyAdmin to admin your remote database, then you’re doing it wrong. Don’t expose your database to the outside world like this, instead use a SSH tunnel. In your terminal simply create the tunnel: [crayon-5f7056c417c6f581468277/] Then in your MySQL interface of choice just connect to 127.0.0.1 port 8888 and voila, you’ll be connected to your remote database. Apps like Querious even let you setup the connection internally without having to tunnel through […]

Law of Demeter and the delegate method

computing / rails

The Law of Demeter, or Principle of Least Knowledge is a fairly simple design pattern, which, simply put means that an object should only talk to it’s immediate “friends” The law states that a method M of and object O may only invoke the methods of the following kind: 1. a method on O itself2. any parameters passed to M3. any objects instantiated within M4. any direct components of O The classic example coined by […]

From TextMate to Vim

computing / programming

I’ve finally done it. After months and months of on-off usage of Vim, I’m now finally using it 100% of the time. It’s been a long and hard road getting here, but let me tell you, it’s been well worth it. I now feel like I absolutely fly through my code. I’ve read many a time, people saying that watching someone using Vim is like watching something mystical, and I can see why. Looking at […]

Vlad 2.0 Not Finding Tasks in deploy.rb

computing / programming

When I restalled all my gems on Snow Leopard, vlad refused to find any of the tasks I had defined in my deploy.rb. I thought this was a SL issue but turned out a week before it’s release Vlad had been updated to version 2 which used a new plugin system. Looking for vlad rake tasks returned an error: To solve the problem just required an install of the new vlad-git gem. Now all my […]

The Code Shall Set You Free

computing / programming

I was recently asked why I don’t comment my code. It’s a fair enough question. There was a time when commenting your code was the done thing. I was once a great believer in commenting code as much as possible and would bash those that didn’t, but now I vary rarely comment my code at all. In my current project of over 1,500 LOC, there are only a handful of comments. Many people will argue […]

rake spec fixtures failing

programming / rails

For some reason my rspec fixtures were not loading into my development database when doing spec:db:fixtures:load. An extra parameter to db:fixtures:load is all that’s needed. [crayon-5f7056c417eec438506000/] Fixed by: [crayon-5f7056c417ef0908698333/]

So you want to be a developer?

computing / work

I’m so glad that I’m not just getting started as a web developer these days. Facebook is the main example I give to people when talking to about this. It has set the standard for what and how people think a web app should behave. Move forward or backwards through photos and they are dynamically loaded without refreshing the page. Send someone a message and a modal box appears with autocomplete on the textboxes. You […]

RSpec + Autotest + Growl + Doom Guy

computing / programming

I spent this morning playing around with autotest, but was getting really flaky results with the Growl notifications. I tried about four different autotest configs, but none of them seemed to consistently worked. I remembered that the Growl notifications at Thursday’s Coding Dojo worked pretty well, so after some digging around I found the config on their github. After a tiny tweaking I was even able to get it to work with Przemysław Kowalczyk’s Doom […]

Goodbye Grails

computing / programming

It finally came time to un-subscribe from all the Grails feeds I used to read. As I’ll no longer be doing any Grails it makes little sense to really keep up with what’s going on in the Grails world. Grails has a lot going for it, but even after over a year of doing it, it just never felt as smooth or dreamy as Rails always has. It managed to replicate some of the core […]