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 GatewayPagLw | |
VALID_PAG_TYPES = {:boleto => 'BOLETOLOCAWEB', :visa => nil, :redecard => nil} | |
VALID_ENVIRONMENT = {:producao => 'PRODUCAO', :teste => 'TESTE'} | |
def initialize(pag_type, environment, identification) | |
raise "Payment type #{pag_type} unknown" unless VALID_PAG_TYPES.include? pag_type | |
raise "Environment type #{environment} unknown" unless VALID_ENVIRONMENT.include? environment | |
@pag_type = pag_type |
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
--- | |
:bulk_threshold: 1000 | |
:backtrace: false | |
:sources: | |
- http://gemcutter.org | |
- http://gems.rubyforge.org/ | |
- http://gems.github.com/ | |
gem: --no-ri --no-rdoc | |
:benchmark: false | |
:update_sources: true |
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
require 'nokogiri' | |
doc = Nokogiri::XML(File.open('/home/felipe/banco_belasoft.xml', 'r')) | |
doc.search('ROOT//row').each do |c| | |
MyCustomerModel.create ( | |
:old_code => c.search('field[@name="codigo"]').text, | |
:name => c.search('field[@name="nome"]').text, | |
:gender => c.search('field[@name="sexo"]').text, | |
:birth => c.search('field[@name="data_nascimento"]').text, |
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 MultiParameterAttributes | |
def filter_time(attributes, name) | |
attrs = attributes.collect do |key, value| | |
if key =~ /^#{Regexp.escape(name.to_s)}\((\d+)(\w)\)$/ | |
[$1.to_i, value.send("to_#$2")] | |
end | |
end.compact.sort_by(&:first).map(&:last) | |
Time.zone.local(*attrs) unless attrs.empty? | |
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
warlley@fmdev-01:~$ ruby -rhttpclient -e 'c = HTTPClient.new;c.ssl_config.verify_callback = ->(ok, ctx){ p [ok, ctx.current_cert.subject];true }; c.get("https://graph.facebook.com/")' | |
[true, /C=US/O=Entrust.net/OU=www.entrust.net/CPS incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Secure Server Certification Authority] | |
[true, /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA] | |
[true, /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3] | |
[true, /C=US/ST=California/L=Palo Alto/O=Facebook, Inc./CN=*.facebook.com] | |
warlley@fmdev-01:~$ ruby -rhttpclient -e 'c = HTTPClient.new; c.ssl_config.clear_cert_store; c.ssl_config.add_trust_ca("/home/warlley/restclient_with_cert/lib/cert"); c.ssl_config.verify_callback = ->(ok, ctx){ p [ok, ctx.current_cert.subject];true }; c.get("https://graph.facebook.com/")' | |
[false, /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA] | |
[false, /C=US/O=DigiCert Inc/OU=www.digicert.com/CN |
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 'rubygems' | |
require 'nokogiri' | |
require 'find' | |
FIND_PATH = "/Users/warlley/Downloads/nfe" | |
Find.find(FIND_PATH) do |file_path| | |
if File.extname(file_path).downcase == '.xml' | |
nfe = Nokogiri::XML(File.open(file_path)) |
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
config.generators do |g| | |
g.orm :mongoid | |
g.template_engine :erb | |
g.test_framework :rspec | |
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
xml.instruct! :xml, :version => "1.0" | |
xml.rss :version => "2.0" do | |
xml.channel do | |
xml.title "Titulo do blog" | |
xml.description "Este é um blog sobre..." | |
xml.link posts_url | |
for post in @posts | |
xml.item do | |
xml.title post.title |
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
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
function proml { | |
local RED="\[\033[0;31m\]" | |
local LIGHT_RED="\[\033[1;31m\]" | |
local YELLOW="\[\033[0;33m\]" | |
local LIGHT_GREEN="\[\033[1;32m\]" | |
local WHITE="\[\033[1;37m\]" |
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
*.dcu | |
*.ini | |
*.~* | |
*.bdsproj | |
*.cfg | |
*.dproj | |
*.dproj.local | |
*.bdsgroup | |
*.bdsgroup.local | |
*.bdsproj.local |
OlderNewer