Skip to content

Instantly share code, notes, and snippets.

class Boot
def run
load_initializer
extend_environment
Rails::Initializer.run(:set_load_path)
end
def extend_environment
Rails::Initializer.class_eval do
old_load = instance_method(:load_environment)
@stevenhaddox
stevenhaddox / code_setup.md
Created June 30, 2011 08:32
undefined method `[]' for nil:NilClass in OmniAuth Custom Strategy

RESOLVED

Figured out this error, please DISREGARD! We were forgetting to redirect to the callback_url at the end of the request_phase as we thought that was handled by OmniAuth (oops...)

To replicate this error you should be able to do the following:

@stevenhaddox
stevenhaddox / am_i_going_crazy.txt
Created May 31, 2012 13:44
Failing Jenkins Suite with All Passing Specs.... ?!
+ bundle exec rake test --trace
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /var/lib/jenkins/workspace/<app_name>/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
@stevenhaddox
stevenhaddox / bundle_package_safe.md
Last active December 12, 2015 00:49
Is it safe to use $ bundle package and subsequently $ bundle install --local for your deploy while waiting for the new rubygems.org?

Can you bypass RubyGems.org and still deploy?

If you can run the following command and get the following result:

$ bundle check                                                                             
The Gemfile's dependencies are satisfied

CONGRATULATIONS!

You can run the bundle package command and still deploy your project without needing to touch RubyGems.org (perhaps stick in 127.0.0.1 in your hosts file if you're still concerned):

@stevenhaddox
stevenhaddox / gist:5613327
Created May 20, 2013 16:16
Anyone seen / know how to fix this yajl gem error in JRuby?
[sysadmin@support chef-11.4.4]$ jruby -S irb
irb(main):001:0> require 'rubygems'
=> false
irb(main):002:0> require 'yajl'
LoadError: load error: yajl/yajl -- java.lang.UnsatisfiedLinkError: failed to load shim library, error: /home/sysadmin/opt/stow/jruby-1.7.4/lib/native/x86_64-Linux/libjruby-cext.so: cannot open shared object file: No such file or directory
from org/jruby/RubyKernel.java:1054:in `require'
from /home/sysadmin/opt/stow/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:36:in `require'
from /home/sysadmin/opt/stow/jruby-1.7.4/lib/ruby/gems/shared/gems/yajl-ruby-1.1.0/lib/yajl.rb:1:in `(root)'
from org/jruby/RubyKernel.java:1054:in `require'
from /home/sysadmin/opt/stow/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:1:in `(root)'
@stevenhaddox
stevenhaddox / gist:7112121
Created October 23, 2013 03:20
Create a bootable Linux (Ubuntu, CentOS, Scientific Linux, etc). USB Thumb Drive from OS X
hdiutil convert -format UDRW -o ~/Downloads/SL.59.020213.CD.x86_64.disc1.img /Users/steven/Downloads/SL.59.020213.CD.x86_64.disc1.iso
diskutil list
diskutil unmountDisk /dev/disk2
sudo dd if=~/Downloads/SL.59.020213.CD.x86_64.disc1.img.dmg of=/dev/disk2 bs=1m
diskutil eject /dev/disk2
@stevenhaddox
stevenhaddox / init_ansible_on_SUPPORT_vm.txt
Created November 14, 2013 18:57
Vagrant expected output for initial SUPPORT VM provisioning configuration
$ vagrant provision
[default] Running provisioner: ansible...
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
<33.33.33.10> REMOTE_MODULE setup
failed: [33.33.33.10] => {"failed": true, "parsed": false}
invalid output was: Traceback (most recent call last):
File "/tmp/ansible-1384455237.04-1936301366699/setup", line 98, in ?
@stevenhaddox
stevenhaddox / apt_or_yum_ansible_logic.yml
Created November 15, 2013 05:33
Ansible file showing apt or yum logic
---
- name: Unpack JDK7
action: command creates=${jvm_folder}/jdk1.7.0 chdir=${jvm_folder} tar zxvf ${jvm_folder}/$jdk_archive --owner=root
register: jdk_installed
only_if: "'$ansible_pkg_mgr' == 'apt'"
- name: Install JDK7 RPM package
action: command creates=${jvm_folder}/latest chdir=${jvm_folder} rpm --force -Uvh ${jvm_folder}/$jdk_archive
register: jdk_installed
only_if: "'$ansible_pkg_mgr' == 'yum'"
@stevenhaddox
stevenhaddox / group_vars-all.yml
Last active December 29, 2015 06:19
Manually force ansible to prepend sourcing a user's bash environment before executing commands
# {{root_path}}/group_vars/all.yml
---
src_bash: "source {{HOME.stdout}}/.bashrc;"

Keybase proof

I hereby claim:

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

To claim this, I am signing this object: