Skip to content

Instantly share code, notes, and snippets.

@justinhennessy
justinhennessy / gist:5333624
Last active December 15, 2015 22:29
vi cheat sheet

Add something to the end of a line

1,$ s/$/",/g

Add something to the start of a line

1,$ s/^/"/g

Turn on/off line numbers

Capybara

save_and_open_page

Matchers

have_button(locator)

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@justinhennessy
justinhennessy / queue_fix.rb
Last active December 19, 2015 22:28 — forked from stuart/queue_fix.rb
De dup RabbitMQ queue
!#/usr/env ruby
require 'json'
require 'uri'
# Removes repeated USER records from one of the AMQP queues.
#
# USAGE: ruby queue_fix.rb "queue_name" "email_address"
#
# This will dump the whole queue to a temp file. (In case anything goes wrong)
# it will strip out the user messages containing the email provided then
@justinhennessy
justinhennessy / gist:6173402
Last active December 20, 2015 18:08
Class methods discussion
def user_with_highest_kilometers
highest = User.new
users.each do |user|
highest = user if user_distance_sum(user) > user_distance_sum(highest)
end
highest
end
def user_with_highest_ascent
highest = User.new
@justinhennessy
justinhennessy / gist:6678630
Last active December 23, 2015 18:49
Supporter API test commands

Campaign list

Command line

curl -i https://everydayhero.com/api/v2/campaigns.json?charity_id=au-2

In the browser

https://everydayhero.com/api/v2/campaigns.json?charity_id=au-2
@justinhennessy
justinhennessy / gist:7081250
Created October 21, 2013 09:43
Mycharity git document
@justinhennessy
justinhennessy / gist:7081269
Last active December 26, 2015 02:49
mycharity working with branches

To start a change on a repo with a branch

git pull
(this gets the local master branch up to date)

git checkout -b my_new_feature

You can then start working on your changes.

Once you have completed your changes do the following:

Introducing Hiera!

Hiera allows us to define data structures that can then be accessed in a class and passed to a template.

This PR shows how it can be used to pass in different URLs for apache rewrites dependant on the environments domain.

Hiera's main config lives in /etc/puppet/hiera.yaml

---
@justinhennessy
justinhennessy / gist:7115696
Last active December 26, 2015 07:29
A Hiera issue

heira.yaml

---
:backends:
  - yaml

:yaml:
  :datadir: '/etc/puppet/hieradata'

:hierarchy: