Skip to content

Instantly share code, notes, and snippets.

View capoferro's full-sized avatar

Josiah Kiehl capoferro

View GitHub Profile
# starting point (line is too long)
def send_mail(source)
Mailer.deliver(to: 'bob@example.com', from: 'us@example.com', subject: 'Important message', body: source.text)
end
# bad (normal indent)
def send_mail(source)
Mailer.deliver(
to: 'bob@example.com',
from: 'us@example.com',
my_variable = {
a: 'a',
b: 'b'
}
$ sudo ./install.sh -v 10.24.0
Downloading Chef 10.24.0 for el...
Unable to retrieve a valid package!
Please file a bug report at http://tickets.opscode.com
Project: Chef
Component: Packages
Label: Omnibus
Version: 10.24.0
Please detail your operating system type, version and any other relevant details
$ sudo bash install.sh -- -s -v 10.24.0
Downloading Chef for el...
Unable to retrieve a valid package!
Please file a bug report at http://tickets.opscode.com
Project: Chef
Component: Packages
Label: Omnibus
Version:
Please detail your operating system type, version and any other relevant details
$ bundle exec knife search node 'chef_environment:the_env AND run_list:recipe\[the_cookbook\:\:the_recipe\]' -VV
ERROR: knife encountered an unexpected error
This may be a bug in the 'search' knife command or plugin
Please collect the output of this command with the `-VV` option before filing a bug report.
Exception: NoMethodError: undefined method `name' for #<Hash:0x007fd3161bcf60>
Hash.from_dotted_path(:'a.b.c', "value")
#=> {:a => {:b => {:c => "value"}}}
or
#=> {"a" => {"b" => {"c" => "value"}}}
# Passing a string as a first parameter will always return the second. Note that the first parameter in the example above is a Symbol. Wondering if this method should return what's passed in or return strings as keys always.
module ArrayExt
def add_element(element, side = :tail)
case side
when :head
unshift element
when :tail
self << element
else
raise ArgumentError.new('argument \'side\' must be one of :head, :tail')
end
# Berksfile:
# cookbook 'nodejs', github: 'mdxp/nodejs-cookbook'
$ berks install
Installing nodejs (1.0.2) from github: 'mdxp/nodejs-cookbook' with branch: '055db6715e6129e1badbb4c79b6ef8ffb244bd9d'
Using build-essential (1.1.0)
Using apt (1.4.8)
<<<<<<< HEAD
=======
=======
>>>>>>> 0b88b7c... move skip_federated above where it's used
rapier:riot_replay jkiehl$ cat recipes/default.rb
if node['testtt']
raise "omg"
end
node.set['testtt'] = true
rapier:test jkiehl$ vagrant provision
[replay] Running provisioner: Vagrant::Provisioners::ChefSolo...
[replay] Generating chef JSON and uploading...