An implementation of Conway's Game of Life in 140 characters of Ruby.
Created by Simon Ernst (@sier).
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential | |
apt-get -y install git-core | |
# Install rbenv | |
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
# Add rbenv to the path: |
An implementation of Conway's Game of Life in 140 characters of Ruby.
Created by Simon Ernst (@sier).
module Extensions | |
module_function | |
def separate(path) | |
extensions = path.reverse | |
.scan(/\G\w+\./) | |
.map { |e| e[0..-2].reverse } | |
.reverse | |
file_name = path.split(".")[0..-(extensions.size + 1)].join(".") | |
[file_name, extensions] |
" Strip trailing whitespace | |
function! <SID>StripTrailingWhitespaces() | |
" Preparation: save last search, and cursor position. | |
let _s=@/ | |
let l = line(".") | |
let c = col(".") | |
" Do the business: | |
%s/\s\+$//e | |
" Clean up: restore previous search history, and cursor position | |
let @/=_s |
module Mokha | |
class HomeController < Mokha::BaseController | |
def index | |
@view = Mokha::HomePresenter.new | |
@view.user = User.includes(:ratings).find(current_user) | |
@view.user.track('Opened Mokha') | |
end |
dig +short {,www.}example.{com,net,org} |
require 'mongoid' | |
class Foo | |
include Mongoid::Document | |
field :bar, :type => String | |
validates_uniquness_of :bar | |
end | |
foo = Foo.new |
module MyApp | |
class Money | |
include Mongoid::Fields::Serializable | |
def cast_on_read?; true; end | |
def deserialize(object) | |
return nil if object.blank? | |
::Money.new(object[:cents] || object["cents"], object[:currency] || object["currency"]) | |
end |
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb |
∴ RAILS_ENV=test rake db:migrate | |
rake aborted! | |
uninitialized constant RSpec::Core::Hooks | |
/Users/derek/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:29:in `<cl | |
ass:Configuration>' | |
/Users/derek/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:28:in `<mo | |
dule:Core>' | |
/Users/derek/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:4:in `<mod | |
ule:RSpec>' | |
/Users/derek/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:3:in `<top |