Meetups, redux

Me: “Hey, housemate, do I want to go to the local technology group’s monthly hack night tonight? They posted about it to the mailing list but didn’t mention the time, the facilities available, or whether there’d be food, but I managed to figure out the location by looking at older mailing list posts, and I’m guessing it might be at 6pm, the same time they hold their meetups. There’s no information about it on their website.”

Housemate: “What’s the best case and worst case scenarios?”

Me: “Best case: it’s where and when I think it is. There are bunch of cool people hacking on awesome projects. I find someone who is knowledgeable but doesn’t yet have a project to hack on, and they pair with me on Growstuff. Someone has provided pizza, including good vegetarian options, and there are drinks other than beer. We get lots of good stuff done, and they sign up as a contributor long-term.”

Housemate: “And worst case?”

Me: “I take public transport for over an hour to get there, find a motley group of people, some of whom I dislike or who dislike me, others of whom just dismiss me as not a serious/cool enough coder. There is no food, and I haven’t had dinner, so I wind up low blood sugar and cranky. I try to work by myself but nothing goes right and I give up in frustration. I spend over an hour getting home again. In the rain.”

Housemate: “I have to say, the worst case sounds more likely. If you want to get out of the house that badly, you could just go for a walk.”

Housemate gives good advice. I’m going to go for a walk. I wonder if the grocery store has paneer?


A while ago I realised I was starting to get ridiculously cranky and negative about things, so I’ve been trying to turn that around a bit. Lately whenever I catch myself feeling shitty about stuff, I mentally list three things to be thankful for. I try not to repeat stuff (at least not too close together), and I try to think the full sentence, “I’m thankful for…” for each thing, rather than just making a quick list. It seems to be helping so far. So if I seem slightly less cranky lately, that’s partly why.

PS. anyone who refers to this as a “life hack” will get to witness me rolling my eyes and/or miming sticking fingers down my throat, which is way better than the punch in the face that would previously have been my default response.

Rails controller specs: matching on redirect URLs

Yet another thing I figured out painstakingly, by finding random bits of documentation in places other than the documentation, because apparently that’s how Rails rolls.

Here’s my situation. I have a controller spec like this:

  describe "GET checkout" do
    it "redirects to Paypal" do
      member = FactoryGirl.create(:member)
      sign_in member
      order = Order.create!(:member_id =>
      get :checkout, {:id => order.to_param}
      response.should redirect_to ""

Basically I want to check that when someone checks out, they get sent to Paypal. Easy peasy, right? The thing is, I don’t know the exact URL they’ll get sent to — it’ll be big and complicated and have lots of parameters on it, and it’ll be different in test anyway, and umm… ok, well, basically I just want to test whether I get redirected, and whether it’s to somewhere paypal-like. Ideally I want to do something like:

# doesn't work
response.should redirect_to /paypal\.com/

… and have it do a match against the URL it’s redirecting to. But that doesn’t work.

I googled every-fucking-where trying to find out what else I could do with the response object, but it doesn’t appear to be documented anywhere official. In the end I found this blog post on Response object methods by Jeff Roush. Thanks, Jeff!

In conclusion, here’s how I’m testing for a redirect that matches against a regexp:

response.status.should eq 302
response.redirect_url.should match /paypal\.com/

(There’s also a redirect_url_match? but it seems to be deprecated.)

Hope that helps someone else, and that they find the answer more quickly than I did.

Testing PayPal Express with ActiveMerchant’s BogusGateway (and how to make it work)

If you’re writing a Rails app with PayPal Express checkout, and having trouble testing because ActiveMerchant’s BogusGateway doesn’t support PayPal-specific methods like setup_purchase, here’s a fix. I spent a while figuring this out the other day so I thought I’d note it here in case someone else is googling.

The problem

Presumably you are writing a Rails app, and are following the instructions in the RailsCast #146 Paypal Express Checkout, or something along those lines.

In your config/environments/test.rb you have:

config.after_initialize do
  ActiveMerchant::Billing::Base.mode = :test

The BogusGateway just mocks the behaviour of a real payment gateway, so that you can run your tests without connecting to a real one — even in test mode. This means you can run your tests offline, for example.

So far so good. Then in your controller you have something like:

response = EXPRESS_GATEWAY.setup_purchase(,
    :ip                => request.remote_ip,
    :return_url        => new_order_url,
    :cancel_return_url => products_url

When you try to test the checkout method in your controller, however, you see an error message like:

undefined method `setup_purchase' for #

The problem is that ActiveMerchant::Billing::PayPalExpressGateway provides a number of methods that BogusGateway doesn’t duplicate. Why not? Well, apparently PayPal Express is a bit of an odd duck in the ActiveMerchant world, and mumble mumble no real reason.

The solution

There’s a pull request by sideshowcoder submitted to ActiveMerchant which creates a PayPalBogusGateway that does all the necessary PayPal-Express-specific things, but it got turned down as “not a common enough use case”. Personally I think that ActiveMerchant shouldn’t have shipped the Paypal Express functionality in an untestable form, but whatevs. You can use sideshowcoder’s fix in your own app, as follows.

First of all, in order to monkeypatch in this way, you’re going to have to take a copy of the gem and put it in your vendor/ directory. I did so following the instructions in this blog post, specifically:

  • Download the activemerchant gem from
  • gem unpack ~/activemerchant-1.33.0.gem --target vendor/gems
  • Repeat for the active_utils gem, which is also required.

Then in my Gemfile, I have:

gem 'activemerchant', '1.33.0',
  :path => 'vendor/gems/activemerchant-1.33.0',
  :require => 'active_merchant'
gem 'active_utils', '1.0.5',
  :path => 'vendor/gems/active_utils-1.0.5'

Finally, after running “bundle install” to make sure that all worked, I dropped paypal_bogus.rb into the appropriate place in my vendors/ directory.

Congratulations, you can now test your Rails app’s interaction with PayPal Express. Hopefully the googles will take note, and the next person searching for this won’t have to pound their head against it quite as hard as I did.

(Thanks also to Ben Bleything for some help on Twitter with the vendored gem part of this.)

Fed up with meetups

I went to a tech meetup the other night, an introductory session about a technology I’m interested in using. It was advertised for 6pm, so I arrived at 5:59, and found a note on the door saying it was starting at 6:30. I wasted half an hour wandering around and went back, to find a bunch of people standing around drinking beer. I didn’t know any of them, I was cranky about having shovelled in an early dinner and hauled ass into the city to be on time when it wasn’t necessary, and I don’t drink beer, so instead of socialising I decided to just grab a seat and mess around on my phone. The seats were epically uncomfortable. I looked around and saw a couple of nicer seats, so I moved to one of those. Better. I checked my email and read some of my RSS feeds.

The event organiser — friendly guy, and good on him for being sociable, I’m not complaining about that — came over and asked where I was from. I was momentarily discombobulated. Melbourne? Thornbury? I’ve just come all the way from Thornbury to be here. What did he want to know? I looked confused, and he rephrased: where did I work? Oh. I told him about Growstuff, and why I was interested in the technology the meetup was about. We chatted for a minute and he moved on.

The first talk was interesting, I guess, though I found it hard to enjoy because I’d been kicked off my comfy seat by someone who “owned” it — he worked at the company hosting the meetup and had brought his desk chair to sit in — and I was in one of the back-breaking plastic monstrosities they’d set out for the group. The talk seemed to mostly be a tour of one of the basic examples/tutorials for the technology in question, but with added commentary/advice/thoughts from someone who really knew his way around it. That was good. But was it good enough to make up for the pain and crankiness and general unpleasantness? I had a headache coming on. I took out my knitting, which at least is soothing and lets me listen without otherwise fidgeting. It helped a bit.

After the first talk there was a break, with pizza. They hadn’t advertised the pizza or mentioned it in the meetup announcement. Had I known, I wouldn’t have rushed to eat something before 6pm, and now I wasn’t hungry. There was still nothing to drink except for beer. Everyone was standing around chatting and they were all cooler and trendier and smarter than me and I wanted to cry.

I went home early.

An interesting documentary

A couple of weeks ago I was reading an article about Israeli politics and found myself turning to Wikipedia to fill in some of the gaps in my knowledge. Approximately 200 Firefox tabs later I found myself watching orthodox Jewish women’s headscarf howtos on Youtube, learning about Third Order Franciscan monks and nuns, and — eventually — watching documentaries about Anabaptist sects in North America.

This is one of the most interesting I found:

It’s a 1-hour documentary about Amish family life. A single Amish family went against their church’s teachings and allowed a British documentary crew to come and film them over the course of a year. However, things get really interesting about halfway in, when we find out that they’re part of an underground movement within the Amish community. I wonder what happened afterwards, and whether their church found out?

And a third thing:

3) I’ve been sitting on this for a little while, but it’s been announced now, so: I’ll be keynoting Open Source Bridge in Portland, Oregon (USA) in June. I know a bunch of my people will be there and I can’t wait to see you all. If you have never been to Open Source Bridge before, it’s one my my favourite conferences, bridging (get it!) software and social responsibility in a way that you don’t see many other places. I’m pretty sure I’ll be talking about Growstuff and how growing food is like writing software. It is, really!

So hey, two things:

1) Growstuff is live. Go check it out. It’s what we’re calling a “soft launch” and we’re still building features at a cracking rate, but it’s there and it works and we want people to try it out. (What’s Growstuff? Haven’t you been paying attention? It’s a social website for vegie gardeners. It’s an open source project. It’s an app platform AND a dessert topping.)

2) The Disreputable Order of Hopperites, a Melbourne gathering of geeky/technical women, is having its second meeting next Monday. It’s a really chill, fun group, with interesting talks. If you are in Melbourne, identify as a woman/girl/female, and are into technical things, you should come! Register at the link above. We still need another speaker, too, if you have a tech topic you’d like to talk about for ~15 mins.

Why Growstuff is Open Source

This was originally posted on the new Growstuff blog, which I set up the other day. I also set up a fortnightly newsletter, to which you should subscribe if you want to keep up with what’s happening with Growstuff as we count down to our public launch, in (eep!) about 2-and-a-bit months.

My background is in open source software, and I’ve been using and producing it for almost twenty years. Sometimes it’s easy to live in the open source bubble, and fail to notice that there are areas where open source software is not common or standard. Over the past few months, working on Growstuff, I’ve attended a number of events for social enterprises and sustainability, and checked out dozens of websites aimed at food gardeners or people trying to live more sustainable lives. Venturing outside my former bubble, I’ve found that open source software is the exception rather than the rule in these areas, so I thought it would be a good idea to talk about why Growstuff is open source, and why we think it’s important.

It’d be traditional at this point to talk about what open source software is, and to give a quick definition. But open source is at least three things, and each needs its own explanation.

First of all, open source is a political movement that aims to change the power balance between software creators and software users. When you use traditional software, you have to take it as-is. If you don’t like it, you have few options. Software makers can change the software any way they like, charge you what they want for it, or withdraw their support for it at any time. You’re locked in an unequal relationship with them, where they hold all the power. Open source software gives power back to the users, letting them — us — understand how it works, use the software how we want, modify it if we need to, and access it regardless of who we are, where we’re from, or how rich we happen to be.

It does this through special software licenses. You’ve probably clicked “Accept” on a lot of software licenses in your time, and open source licenses are just like this, except that they offer you (as a software user) a bunch of rights, where other licenses typically take them away. An open source license says that you have the right to use the software for any purpose whatsoever. It says that you’re allowed to read the source code — the underlying program that makes the software run — and to change it if you need to, to suit your needs. It says that you can share the software freely, passing it on to friends or colleagues without having to pay license fees or worry that the software creator will come after you. In some cases (as in the license Growstuff uses) it says that if you modify the software and share it with others, you must use the same open source license, to make sure that people down the line have the same rights you do, and to share the love as widely as possible.

Finally, by changing the balance of power between software creators and users, and enshrining that greater equality in a formal document, we open ourselves up to a more collaborative way of working. Software creators and users are able to come together to build the software they need, and users can even contribute directly to the software itself, by modifying the source code and offering their changes back to the original creator. Over the years, open source software developers have learned all kinds of effective ways to work together as distributed, often international teams, and to engage their user communities in developing something that they really want to use and in which they feel a sense of ownership.

So what’s this got to do with social enterprise, sustainability, and Growstuff? In my mind, open source, sustainability, and social enterprise are closely intertwined, to the point where I feel that choosing open source is a vital part of the whole picture.

When we talk about social enterprises — businesses that hope to achieve a social good through their business activities — we seldom look at their software practices. But the choice of software to use, or decision to develop software under a closed or open model, has a social impact, just as do the choice of environmentally friendly materials for physical manufacturing, or the decision to employ people from disadvantaged backgrounds. We expect social enterprises to follow ethical business practices; why not expect them to follow software practices that support equal access, transparency, and accountability?

When it comes to sustainability, it’s about more than changing your light bulbs or using a fancy water bottle. Sustainability’s about developing communities and ways of living and working that can survive and thrive in the long term. Open source is a sustainable way of building software. If a company that writes closed software goes under, the software dies with it, but an open source software project can live long beyond the people or institutions that started it. Since there’s a broad community of people familiar with the software, who know how to read and modify its source code, new developers can step up. An open source project is one that builds community and resilience against all kinds of change: exactly what sustainability is about!

These are the reasons why we think it’s important that Growstuff be open source. We want to work openly and ethically, in collaboration with our members, building a community that feels a sense of ownership and deep involvement in the software that runs our website. We want other projects, especially those working in similar areas, to be able to look at what we’re doing and learn from us, through reading or re-using our source code. We want to know that if something happens to Growstuff itself, a new Growstuff — or a hundred new Growstuffs — could sprout up, and that people could continue to benefit from what we’ve built far into the future.

Hurrah, I’m $37 richer!

Just a quick post to note that Growstuff (my open source project for food gardeners) was selected as one of the winners of Pinboard’s satirical startup incubator program. I get $37 in funding, woohoo!

While the $37 won’t pay for much of anything — that’s the point, after all — I’m looking forward to Maciej’s advice and help with getting our name out there, and to getting to know the other winners. I’m pleased to see another food startup on the list (home baked goods via the Internet!), would love to be able to use the pre-hardened machine images for AWS, and can’t help but be excited that a sailing-related startup is amongst the winners. While I don’t play board games much, nor have a kid in school, both those projects sound useful and likely to succeed, too. Congrats to my co-selectees!

Inflection point

I just asked the Internet to crowdsource a professional bio for me, figuring that literally anything would be better than having to write one myself. The results aren’t bad, though the process was far messier than that would suggest. (Etherpad link will disappear in 30 days, may get messed up before that. I’ve saved a copy offline for posterity.)

My favourite quote from the process, from Sumana:

She reinvents herself so frequently that any given moment is an inflection point, unextrapolatable.

I don’t know where I can possibly use that, but I love it, so I’m posting it here.