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
| True = lambda { |a,b| a } | |
| False = lambda { |a,b| b } | |
| display = lambda { |boolean| boolean['true','false']} | |
| display[True] # => "true" | |
| display[False] # => "false" | |
| And = lambda{ |b1,b2| b1[b2,b1] } | |
| Or = lambda{ |b1,b2| b1[b1,b2] } |
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
| module SQLGrowler | |
| class Subscriber < ActiveRecord::LogSubscriber | |
| def sql(event) | |
| super | |
| g = Growl.new("localhost", "ruby-growl", ["ruby-growl Notification"], ["ruby-growl Notification"], nil) | |
| g.notify('ruby-growl Notification',application_name,'%s (%.1fms) %s' % [event.payload[:name], event.duration, event.payload[:sql].squeeze(' ')],1,true) | |
| end | |
| def application_name |
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
| git log --pretty='format:(%cr) - %s %d' | tail -r | |
| git log --pretty='format:%Cblue(%cr) %Cred%s %Cgreen %d %Creset' | tail -r |
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
| #!/usr/bin/env ruby | |
| require 'date' | |
| require 'rubygems' | |
| begin | |
| require 'metric_fu' | |
| require 'reek' | |
| require 'roodi' | |
| rescue LoadError | |
| puts "Error loading gems. Try this: gem install metric_fu reek roodi" | |
| exit |
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
| #!/usr/bin/env ruby | |
| require "yaml" | |
| commands = "" | |
| info = YAML.load(`rvm info`) | |
| info.values.first["environment"].each do |k,v| | |
| commands << %Q{export #{k}="#{v}"\n} | |
| end | |
| puts commands |
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
| def use_selenium_driver driver | |
| $__capybara_selenium_driver_name = driver | |
| end | |
| def selenium_driver | |
| $__capybara_selenium_driver_name || :firefox | |
| end | |
| def (Capybara::Driver::Selenium).driver | |
| unless @driver |
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
| Feature: Manage projects | |
| In order to easily reference projects and keep them up to date | |
| As a project team member | |
| I want to manage projects information | |
| Scenario: Add a new project | |
| Given I am on the home page | |
| When I follow "Create Project" | |
| And I fill in "New project name" with "Unique Vegetable" | |
| And I press "Create Project" |
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 MariaSapatao < (6..18).include?(Time.now.hour) ? Maria : Joao | |
| end | |
| class Pedro | |
| def do_you_know_jesus? | |
| !!!jesus | |
| 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
| export PATH=/opt/subversion/bin:$PATH | |
| # MacPorts Installer addition on 2009-02-17_at_01:38:51: adding an appropriate MANPATH variable for use with MacPorts. | |
| export MANPATH=/opt/local/share/man:$MANPATH | |
| # Finished adapting your MANPATH environment variable for use with MacPorts. | |
| export JAVA_HOME=/Library/Java/Home | |
| # Setting PATH for MacPython 2.5 | |
| # The orginal version is saved in .profile.pysave |
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 Time | |
| def day_light? | |
| (6..18).include? self.hour | |
| end | |
| end | |
| class Maria | |
| def greet | |
| p "Bom dia" | |
| end |