I wrote a blog post about how to set up your linux machine to play nice with Ruby on Rails […]
Category: Ruby
Simplify your configurable hooks
Sometimes we want to have option to enable/disable some git hooks. We can create if for each, but we should […]
Install Ruby + Sinatra on Ubuntu LTS 12.04
Based on this tutorial. Step One Update aptitutde: sudo apt-get update Install curl: sudo apt-get install curl Get and install […]
If you’re not Surprised by how Good you are it could be a Sign you’re not Improving
About a year ago I made the jump from PHP to Ruby and I haven’t looked back. Ruby and more […]
Fixing bundler issues like “git@github.com:… is not checked out. Please run `bundle install`”
This is one of the weirder issues and I am still not entirely sure, how that happens. My current guess […]
Ruby Simple Transformation String Method
def transform_string(string) transformed_string = string.dup char_positions = [] (‘A’..’Z’).each do |char| break if char_positions.size >=2 position = string.index(char) next if […]
Rails: Casting Objects as Arrays
I’ve run across Rails code like the following several times: def emails # force emails into an array if not […]
Journey from C# to Ruby.
I’ve been programming with C# for >90% of my professional career. It was the second language I learned (the first […]
Xcode 4.5.2, RVM & MacRuvy
No se porque sucede, pero cuando instalo MacRuby con RVM me saca un error respecto a la libreria MacRuby.framework Para […]
List all gems without version numbers, and easily re-install them
Sometimes when upgrading ruby versions or moving from one dev machine to another I want a list of all my […]
method.source_location
ActiveSupport::JSON.method(:encode).source_location [“/Users/me/Work/railsproject/bundle/jruby/1.9/gems/activesupport-3.2.13/lib/active_support/json/encoding.rb”, 30]
Or not.
irb: foo = false || true ===> true irb: foo ===> true irb: foo = false or true ===> true […]
Custom Carrierwave Processors with Minimagick
Need to do some custom processing other than resize using Carrierwave? Multiple commands in a single convert line? image = […]
Excel Downloads for Rails Active Admin
Using Active Admin? https://github.com/gregbell/active_admin You are going to love this: https://github.com/randym/activeadmin-axlsx Just the facts [gender neutral honorific] Put this in […]
Paperclip 4.0 File Detection
Paperclip 4.x includes automatic file content type detection: https://github.com/thoughtbot/paperclip#security-validations If you want to include detection of newer Microsoft Office and […]
Module Function
Differences module MM def test puts “test” end end class CC def call_test test end end MM.test #=> NoMethodError CC.new.call_test […]
Can’t remember a method name for a ruby object
Go into irb and do obj.methods.sort Gives you a nice sorted list of method names associated with your object
var_dump($var_object) equivalent in Ruby
PHP <?php var_dump($var_object); ?> Ruby puts var_object.inspect
Install rmagick on OS X Mountain Lion
If you have to crop or manipulate images with Ruby sometimes you may consider using ImageMagick , an open source […]
ETL functionality with Ruby via Goldmine
Something Nate Hopkins has been working on. Here is a snippet from the doc: Goldmine allows you to apply pivot […]