Isaac Sloan - Web Developer, Photographer, Musician and Citizen of Earth
Banner700

How to Create a Ruby Gem

November 10, 2014

1. Create your gem:

Here is the most modern approach to gem crafting:

bundle gem gemname
cd gemname

edit your_gem.gemspec and add description, summary, required gems and optional website. Add required gems for development such as rspec, rails or minitest to the Gemfile.

2. Add testing framework:

RSpec:
rspec --init
touch spec/your_gem_spec.rb
Minitest:
# Rakefile
How to Create a Ruby Gem

Setting up Ruby on Rails for OSX (10.10) Yosemite

March 20, 2015

Very little has changed since Mavericks but here's an updated tutorial.

Step 1: Install XCode Command Line Tools

xcode-select --install

Step 2: Install and prepare Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update

Step 3: Install rbenv

brew install rbenv ruby-build openssl
Setting up Ruby on Rails for OSX (10.10) Yosemite

Saving dynamic serialized fields with fields_for in Rails

February 23, 2015

Tell you model to serialize it as a struct and create a setter to build the struct on create.

# post.rb model
serialize :content, OpenStruct
def content=(v)
  self[:content] = OpenStruct.new(v)
end

Then you can add any form elements you want for content.

-#form partial

= f.fields_for :content, @post.content do |ff|
  .field
    = ff.label :name
    = ff.text_field :name
  .field
Saving dynamic serialized fields with fields_for in Rails

Petergate Authorizations

January 18, 2015

"If you like the straight forward and effective nature of Strong Parameters and suspect that cancan might be overkill for your project then you'll love Petergate's easy to use and read action and content based authorizations."

-- I proclaim optimistically

Installation

Petergate Authorizations

My vimrc

November 12, 2012

" " ========================================================================
" " Isaac Sloan - Vim Configuration 2012
" " ========================================================================
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'

" My bundles
Bundle 'ervandew/supertab'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-rails'
Bundle 'tpope/vim-haml'
Bundle 'slim-template/vim-slim'
My vimrc