Skip to content

Instantly share code, notes, and snippets.

View jongilbraith's full-sized avatar

Jon Gilbraith jongilbraith

  • Cornwall, UK
  • 02:25 (UTC +01:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jongilbraith on github.
  • I am jongilbraith (https://keybase.io/jongilbraith) on keybase.
  • I have a public key ASCkz2sbdjbRSMRunvEHVkrRk3VwJOFgZntGlg7sE3pnkwo

To claim this, I am signing this object:

@jongilbraith
jongilbraith / gist:6403880
Last active December 22, 2015 02:29
keychain / json issue backtrace
keychain_contents = SSKeychain.passwordForService('Weight Bar', account: NSUserName())
BW::JSON.parse(keychain_contents)
On 18 Aug 2011, at 16:52, Paul Battley wrote:
> On 18 August 2011 10:44, Matthew Geppert <matt@osrecruit.com> wrote:
>> * Command Line Wizard
>
> Presumably, the office has a steady supply of goats, chickens,
> brimstone, eye of newt, etc.
Indeed, these metaphors have caught me out in the past.
@jongilbraith
jongilbraith / gist:1060815
Created July 2, 2011 15:37
Cucumber step to test downloading of files
Then /^I should get a download with the filename "([^\"]*)"$/ do |filename|
page.response_headers['Content-Disposition'].should include("filename=\"#{filename}\"")
end
def each_if_present(collection, options = {}, &block)
options[:empty_message] ||= "Nothing to display"
if collection.present?
collection.each(&block)
else
concat content_tag(:div, options[:empty_message], :class => :no_content)
end
end
# Used for checking a param has the right settings, and initialising it if it's not set.
#
# The following will check param[:cars] and if it's not set initialise it to the default,
# :bugatti_veyron. If it is set but is not in the allowed array it'll also get set to the
# default and log that it had to update it (info).
#
# If you get a request with a parameter in forbidden, it'll also raise a log, but at warn level.
#
# You have two choices on syntax - a block style:
#