Skip to content

Instantly share code, notes, and snippets.

@codebender
codebender / El-Cap-fixes.md
Created October 1, 2015 16:24
El Capitan Dev setup Fixes

El Capitan OSX 10.11 Development setup fixes

  1. Uninstall all rbenv gems
  2. Install Xcode and command line tools xcode-select --install
  3. reinstall openssl??? brew reinstall openssl
  4. Config bundler to use brew installed openssl - bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
  5. Reinstall bundler gem install bundler
  6. reinstall all gems bundle install
@codebender
codebender / gist:9241543
Created February 27, 2014 00:05
Einstein's favorite
There was an old lady called Wright
who could travel much faster than light.
She departed one day
in a relative way
and returned on the previous night.
@codebender
codebender / gist:5327211
Last active December 15, 2015 21:39
Arrayize! convert any non-array object to an array. Leave any existing array alone. Array() doesn't work for hashes.
# Arrayize! convert any non-array object to an array.  Leave any existing array alone.
def arrayize(object)
  return [object] unless object.is_a?(Array)
  object
end

def arrayize2(object)
 Array.new(1) { object }.flatten
@codebender
codebender / arrayize
Created April 5, 2013 19:14
Arrayize! convert any non-array object to an array. Leave any existing array alone.
```ruby
# Arrayize! convert any non-array object to an array. Leave any existing array alone.
def arrayize(object)
return [object] unless object.is_a?(Array)
object
end
def arrayize2(object)
Array.new(1) { object }.flatten
end
@codebender
codebender / rails.validations.bootstrap.js
Last active December 12, 2015 07:58
* override client_side_validations for bootstrap * When using the client_side_validations gem and following the bootstrap html structure, you will need to add this override file or some variation of it.
(function() {
$(document).ready(function() {
return $("div.control-group").focusout(function() {
if (!$("div.control-group").hasClass("error")) {
return $(this).addClass("success");
}
});
});
}).call(this);