This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'libnotify' if RUBY_PLATFORM =~ /linux/ | |
gem 'growl' if RUBY_PLATFORM =~ /darwin/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Prize < Struct.new(:name, :img); end | |
class Level < Struct.new(:name, :order, :image); end | |
class Achievement < Struct.new(:prize, :level); end | |
class Rewarding | |
def add(achviement); end | |
def level_rewards(level_or_order); end | |
def level_for_prize(prize); end | |
def max_rewarding_level; end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instruction = <<-COMMENT | |
# Yo dawg, I heard you like tests that are easy to setup... | |
# | |
# Define domains "trainer.project.test login.project.test" in /etc/hosts | |
# to point to one of your local interface (probably 127.0.0.1) | |
# | |
# /etc/hosts: | |
# 192.168.50.1 trainer.project.test | |
# 192.168.50.1 login.project.test | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
respond_to(:json, :html) do |json, html| | |
json { render :json => UserSessionPresenter.new(current_user) } | |
html { redirect_back_or_default root_path } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AbsenceController < ApplicationController | |
has_widgets do |root| | |
current_role.widgets_for(current_user).each do |widget| | |
root << widget(widget.path, widget.css, :position => widget.position) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AbsenceController < ApplicationController | |
has_widgets do |root| | |
root << widget("absence/absences", "absence_absences") | |
root << widget("absence/events", "absence_events") | |
root << widget("absence/documents", "absence_documents") | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
def local_database?(config, &block) | |
if config['host'].in?(['127.0.0.1', 'localhost', '192.168.30.1']) || config['host'].blank? | |
yield | |
else | |
$stderr.puts "This task only modifies local databases. #{config['database']} is on a remote host." | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tcp 0 0 127.0.0.1:35648 127.0.0.1:9876 TIME_WAIT | |
tcp 0 0 127.0.0.1:9876 127.0.0.1:35646 TIME_WAIT | |
retrying ... | |
tcp 0 0 127.0.0.1:35648 127.0.0.1:9876 TIME_WAIT | |
tcp 0 0 127.0.0.1:9876 127.0.0.1:35646 TIME_WAIT | |
retrying ... | |
tcp 0 0 127.0.0.1:35648 127.0.0.1:9876 TIME_WAIT | |
tcp 0 0 127.0.0.1:9876 127.0.0.1:35646 TIME_WAIT | |
retrying ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):010:0> def m | |
irb(main):011:1> puts defined?(a) | |
irb(main):012:1> a = 1 | |
irb(main):013:1> puts defined?(a) | |
irb(main):014:1> raise "x" | |
irb(main):015:1> b = 3 | |
irb(main):016:1> ensure | |
irb(main):017:1* puts defined?(a) | |
irb(main):018:1> puts defined?(b) | |
irb(main):019:1> end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
def role(obj) | |
obj.role_for = self # if role object needs it | |
@roles << obj | |
end | |
def unrole(obj) | |
@roles.delete(obj) | |
end |