Skip to content

Instantly share code, notes, and snippets.

@blowmage
blowmage / .profile
Last active August 29, 2015 13:55
chruby and ohmygems together at last
# my preferred prompt - ☣ [pairwithme:rails4] $
PS1='\[\e[1;31m\]☣ [\W$(if [ -n "$OMG_NAME" ]; then eval "echo :$OMG_NAME"; fi)] $\[\e[0m\] '
# chruby configuration
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
# set default ruby
chruby 2.1
[vagrant@precise32:/vagrant (master)]$ echo "using search_exec"
using search_exec
[vagrant@precise32:/vagrant (master)]$ rspec spec/models/user_search_spec.rb
/usr/local/rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
/vagrant/vendor/gems/message_bus/lib/message_bus.rb:130: warning: already initialized constant ENCODE_SITE_TOKEN
== Seed from /vagrant/db/fixtures/post_action_types.rb
- PostActionType {:id=>1, :name_key=>"bookmark", :is_flag=>false, :position=>1}
- PostActionType {:id=>2, :name_key=>"like", :is_flag=>false, :icon=>"heart", :position=>2}
- PostActionType {:id=>3, :name_key=>"off_topic", :is_flag=>true, :position=>3}
@blowmage
blowmage / tasks_controller_refactoring.rb
Created November 12, 2012 20:17 — forked from ryanb/tasks_controller_refactoring.rb
Variation of RubyTapas episode "021 Domain Model Events" without using callbacks
class TasksController < ApplicationController
def update
if @task.update_attributes(params[:task])
tracker = PostSaveTaskTracker.new(@task)
TaskPusher.new(tracker, socket_id).push_changes
TaskMailSender.new(tracker, current_user).deliver_email
# success response
else
# failure respond
end
@blowmage
blowmage / tasks_controller_refactoring.rb
Created November 12, 2012 16:52 — forked from ryanb/tasks_controller_refactoring.rb
Variation of RubyTapas episode "021 Domain Model Events" without callbacks, using dirty, and keeping the tracker object.
class TasksController < ApplicationController
def update
if @task.update_attributes(params[:task])
tracker = PostSaveTaskTracker.new(@task)
TaskPusher.new(tracker, socket_id).push_changes
TaskMailSender.new(tracker, current_user).deliver_email
# success response
else
# failure respond
end
@blowmage
blowmage / tasks_controller_refactoring.rb
Created November 12, 2012 16:13 — forked from ryanb/tasks_controller_refactoring.rb
Variation of RubyTapas episode "021 Domain Model Events" without using callbacks or reimplementing dirty tracking.
class TasksController < ApplicationController
def update
if @task.update_attributes(params[:task])
TaskPusher.new(@task, socket_id).push_changes
TaskMailSender.new(@task, current_user).deliver_email
# success response
else
# failure respond
end
end