Skip to content

Instantly share code, notes, and snippets.

View joho's full-sized avatar
At harbour

John Barton joho

At harbour
View GitHub Profile
@joho
joho / COMMIT_MESSAGE
Created June 30, 2009 10:36
our first week without ryan
Marking the end of an era
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README
#
diff --git a/README b/README
require File.dirname(__FILE__) + '/../spec_helper'
def app
ActionController::Dispatcher.new
end
describe "the homepage" do
include Rack::Test::Methods
it "shouldn't crap out" do
~ $ python
Python 2.4.4 (#1, Mar 4 2008, 21:21:26)
[GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
'Use Ctrl-D (i.e. EOF) to exit.'
>>>
===
@joho
joho / health_check.rb
Created August 18, 2009 00:40
Extracted from our health check class - a check to ensure your HAproxy queue is below a certain level
require 'open-uri'
require 'hpricot'
class HealthCheck
HAPROXY_MAX_QUEUE_LENGTH = 20
HAPROXY_SERVER_URLS = %w(localhost:8001 localhost:8002 localhost:8003)
def ok?
problems.length == 0
end
mysql - 64bit 10.5 build
- then reload the db
install homebrew
- install imagemagick
- install libxml2
- install memcached
install rvm
- set up as default
- install the mysql gem - this was a pain (google it for snowleopard)
installed required gems by rake gems:install (do it for RAILS_ENV=test as well)
class SignupController < ActionController::Base
def step_two
@signup = Signup.find(params[:id])
@signup.advance_step do |signup|
signup.attributes = params[:signup]
signup.save!
end
end
end
@joho
joho / Kona one20
Created October 19, 2009 03:25
Going to track all the modifications i make to my bike
Kona one20
---
http://bikes.konaworld.com/09/09_one20primo_uk.cfm
Frame sizes 19"
Frame tubing Kona Race Light Scandium Butted, 5" Travel
Rear Shock Fox Float RP2
Fork RockShox Recon 335 120mm
Headset TH
Crankarms Shimano
@joho
joho / envato-senior-dev.markdown
Created November 16, 2009 05:08
Senior Ruby on Rails Developer @ Envato

Senior Ruby on Rails Developer @ Envato

Hi, we're Envato and we're looking for a "senior" Ruby on Rails developer.

We know it's a bit absurd to ask for seniors for a new-ish technology, but we're more looking for the senior mindset, for depth and breadth of experience in delivering good quality code, and helping your teammates achieve the same. We need the kind of people we can point at a big problem with maybe another dev or two by their side and come out with a neat solution on the other side. We'd prefer to hire someone with practical, commercial Ruby on Rails experience, but if you're a Python, Java, .NET, Haskell, LISP, or whatever else developer who picks up new things quickly and can get things DONE we want to speak with you.

First though: a bit about us. We're a youngish company, transitioning out of the hectic startup days and into something a bit bigger and more settled. We operate a series of online stock digital media marketplaces such as Activeden (formerly FlashDen), GraphicRiver, ThemeF

@joho
joho / object.rb
Created November 18, 2009 11:34
object#respond_to for mutltiple methods at once
class Object
# sometimes it's handy to know
def respond_to_any?(*method_names)
method_names.any? { |method_name| respond_to?(method_name) }
end
end
class ApplicationHelper
def show_for_owner_of(owned_item, &block)
concat capture(&block) if owned_item.user == current_user
end
def hide_from_owner_of(owned_item, &block)
concat capture(&block) unless owned_item.user == current_user
end
end