Adding a custom Spree payment Gateway outside a Rails Engine

Leave a comment
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:

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 wiped out when the Spree core engine sets the initial bogus and simple methods. I got around the problem by hooking my gateway in using the after_initialize method. Here I’m hooking in after SpreeGateway:

Small teams and interruptions

Leave a comment
computing / work

It’s hard for non-programmers to understand just how bad interruptions are when it comes to being a productive coder. While most jobs suffer from the same problems of “getting back into the flow” after being interrupted, programming is especially difficult as normally programmers are trying to hold a number of structures in their head at any one time so as to solve whatever problem it is that they are working on.

In most small companies, the development team is might only consist of three or four people and in such a small team with a large backlog to deliver, it’s not normally the teams size that is the main factor in being able to deliver large amounts of work, but all the small interruptions that happen during daily business. Asking a developer that is sitting close by about when a feature will be ready or whether something can be fixed/changed is all too tempting and easy to do. Why IM or email when you can just shout across the room. It only takes a few 10-20 second interruptions to change a productive three to fours hours into just maybe one or two.

Once a company grows these sorts of problems can be smoothed out by having someone act as a barrier to the developers, shielding them from minor questions/requests and letting them continue with their work until free to discuss them. Small companies don’t have the luxury of assigning someone that role so need to find other means to minimising that contact. It’s important that someone sets some ground rules. It could be as simple as there is a set period of time every day that programmers should not be disturbed or communication should be limited to IM and email if possible. Just removing the constant stream of “Is X ready yet?”, “Did you get a chance to look at Y?” or “Would it be possible to do Z?” would mean a huge productivity boost for your programmers and overall deliverables for your company.

Right now

Leave a comment

Right now, somewhere in the world, a child is being born into an uberly rich family. That child will grow up to inherit millions for absolutely no work. He’ll live the good life full of yachts and private jets.

Right now, somewhere in the world, there is a party happening full of gorgeous wealthy people who need not lift a finger to attain the luxuries that they have. Their success is only a matter of genetics and luck.

Right now, somewhere in the world, is an investment banker who is making literally millions after clicking a few buttons and making a few phone calls to a few friends. He knows the right people and is in the right place, and that’s all that matters.

Right now, somewhere in the world, is a 20-some year old guy who is worth billions because of a website he started. He was born into a family that sent him to the right high school. He then went on to one of the best universities in the country, built his website, moved, met the right people, and raised $500+ million in funding. He and likely generations down the line are set for life.

Right now, somewhere in the world, is a 17yr old teenager who started a company with some money from his parents, built a product, with help from friends and family, and got acquired for $30 million.

There’s always someone becoming richer than you for much less work, every second of the day. Look past that and just keep working. I get down about how unfair that is from time to time, but there’s nothing you can really do about it, other than focus on your work.

Love this comment on the Summly acquisition. Burning up inside about what others have achieved won’t get you any closer to your goals. All you can do is make it fuel your desire even more. So get back to work and make it happen.

Peter’s laws

Leave a comment
  • If anything can go wrong, fix it! (To hell with Murphy!)
  • When given a choice, take both.
  • Multiple projects lead to multiple successes.
  • Start at the top and work your way up.
  • Do it by the book… but be the author.
  • When forced to compromise, ask for more.
  • If you can’t beat them, join them, and then beat them.
  • If it’s worth doing, it’s got to be done now!
  • If you can’t win, change the rules.
  • If you can’t change the rules, then ignore them.
  • Perfection is not optional.
  • When faced without a challenge, make one.
  • “No” simply means begin again at one level higher.
  • Don’t walk when you can run.
  • When in doubt, THINK!
  • Patience is a virtue, but persistence to the point of success is a blessing.
  • The squeaky wheel gets replaced.
  • The faster you move, the slower time passes, the longer you live!
  • Bureaucracy is a challenge to be conquered with a righteous attitude, a tolerance for stupidity, and a bulldozer when necessary.

Why I’ve gone off VC

Leave a comment

When starting a new “startup”, the most likely course of action is MVP, VC, Exit, Profit! For NewsTrapper we were thinking of going down the YCombinator/TechStars route, but at the last minute decided to try bootstrapping it ourselves.

The main reason is that I think there are a lot of valuable lessons to learn trying to go through the whole process of bootstrapping with very little budget, but another factor is that recently I’ve been turned off the idea of VC. One of the main motivators for wanting to create my own business is to be my own boss. While fame and fortune are nice goals, more than anything I want to have freedom to do what I want. When you take VC you basically have a new boss. I don’t want to report to anyone. To have to go to meetings, produce presentations and seek the approval of others before I can make any decisions. Perhaps it’s old age that’s made me more drawn to freedom than money.



When working towards an end goal, it’s easy to focus on nothing but the end. How much more do I have to do? How long do I have left? When all that really matters is what we do today. Reaching goals become a lot easier when we free ourselves from focusing on the long road ahead of us. Focus on today and today alone and the end result will take care of itself.

Do what matters most

Leave a comment

Something that I find a real struggle is staying focused on developing features that actually matter to the end user. Working on NewsTrapper it’s extremely easy to continually work on the more technical Solr/NLP side of things, after all that’s the real heart of the system and where all the challenging work is. The trouble is, improving that part of the system isn’t what’s holding us back from being able to launch. The point of an MVP is to have the minimum features possible for it to be useable. It doesn’t matter if our indexing is terrible as long as someone can come along and use the system in some form of intended fashion.

I find it really useful to review what it is I’m working on and what actually needs to be done almost constantly. Many times I’ll actually drop what I’m doing and move onto something less appealing, but more pressing. Break your system down and answer the question of “What does a user need to achieve their goal?” and do the bare minimum, no matter how bad, to deliver that. If you’re doing a small private beta then it doesn’t have to be perfect, it just needs to prove the point and confirm whether your idea is useful or not.

Don’t spend money to start your business

Leave a comment

You’ve got a new business, you need to get it off the ground, what do you do? Do you spend money on advertising, marketing, sales? No! It’s easy to sit and think you’re doomed because you don’t have a budget. But that is not how small businesses get off the ground. The only expenditure you need to make is one that is paid for in blood, sweat and tears. There are countless examples of businesses that are now huge successes and that started with no money. Don’t waste money on flyers, direct mail campaigns and expensive advertising. Pick up the phone and talk to people. It’s horrible and it sucks, but that’s the price of not having any money to spend in the first place.

I once worked with a group of people who thought that spending nearly £14k on a glass partition for the office we were going to move into would get the investor’s juices flowing. There was a bad culture of spending money there. The company soon folded and we never did move into the new office.

If you’re not shipping, you’re sinking

Leave a comment

Shipping is not easy. Shipping might actually be the hardest part of creating anything. When the moment comes to ship your head is filled with questions and doubts (Thanks Lizard Brain). “What if I’ve made mistakes?” “What if I’ve missed something?” “What if there are bugs?” “What if no one likes what I’ve done?” “Oh if I could just get this extra feature in.” This fear makes shipping hard and as a consequence we push back and back and back. But by doing so we only expose ourselves to ever increasing risk. The risk that there’ll be too many features to debug, the risk that there’ll be too many unknown things to fix, the risk that we’ve been trying to solve the wrong problem all along.

I’ve shipped enough broken deployments that I no longer worry too much about bugs or broken builds. Yes, I’ve had users complain multiple times about things I’ve broken. But, more times then not, getting a half arsed solution out the door quickly has answered more questions and solved more problems then stalling and trying to do something perfectly.

Don’t be afraid of shipping and don’t hold back. No matter what you do, you will never get it right. The wonderful thing about the world is we always have tomorrow to try again.