Skip to content

Instantly share code, notes, and snippets.

View leobessa's full-sized avatar

Leonardo Bessa leobessa

View GitHub Profile
@leobessa
leobessa / worker.rb
Last active August 29, 2015 14:01
sidekiq dynamodb parallel scan
module Sidekiq
module Apns
class Worker
include Sidekiq::Worker
sidekiq_options :queue => :apns_dts
def perform(*args)
# p args
end
end
end
@leobessa
leobessa / metrics
Created April 12, 2010 07:04
script/metrics with metric_fu
#!/usr/bin/env ruby
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
end
@leobessa
leobessa / pair
Created April 12, 2010 07:00
pair authoring script for git
#!/usr/bin/env ruby
require "yaml"
info = File.open( "#{ENV["HOME"]}/.git_authoring.yml" ) { |yf| YAML::load( yf ) }
PAIR_EMAIL = info['email']
AUTHORS = info['authors']
unless File.exists?(".git")
puts "This doesn't look like a git repository."
class Time
def day_light?
(6..18).include? self.hour
end
end
class Maria
def greet
p "Bom dia"
end
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
class MariaSapatao < (6..18).include?(Time.now.hour) ? Maria : Joao
end
class Pedro
def do_you_know_jesus?
!!!jesus
end
end
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"
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
#!/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
#!/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