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 install nokogiri | |
| require 'nokogiri' | |
| require 'net/http' | |
| https = Net::HTTP.new('example.com', 443) | |
| https.use_ssl = true | |
| response = https.get('/') |
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
| print "Informe seu telefone: \n Ex.:(99) 9 9999-9999 " | |
| phone_number = gets | |
| matched = /\([0-9]{2}\) 9 [0-9]{4}-[0-9]{4}$/.match(phone_number) | |
| puts "Meu Whatsapp é #{phone_number}" unless matched.nil? |
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
| # Product | |
| class Product | |
| attr_accessor :description, :price | |
| def initialize(description, price) | |
| @description = description | |
| @price = price | |
| 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
| # source 'https://rubygems.org/gems/cpf_cnpj' | |
| # gem 'cpf_cnpj', '~> 0.5.0' | |
| require 'cpf_cnpj' | |
| print 'Informe seu CPF: ' | |
| user_cpf = gets | |
| if CPF.valid?(user_cpf) | |
| puts 'Cpf válido' |
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
| numbers = [] | |
| print 'Informe um número ' | |
| numbers.push(gets.to_i) | |
| print 'Informe outro número ' | |
| numbers.push(gets.to_i) | |
| print 'Informe outro número ' | |
| numbers.push(gets.to_i) |
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
| # Pegar o nome e idade de uma pessoa através do terminal e imprimir os valores | |
| print "Informe seu nome " | |
| name = gets.chomp | |
| print "Agora precisamos da sua idade " | |
| age = gets.chomp.to_i | |
| puts "Olá #{name}! Parabéns pelos seus #{age} ano(s)" |
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
| @GET | |
| public Response allBooks() { | |
| UriBuilder uriBuilder = uriInfo.getAbsolutePathBuilder().clone(); | |
| // Given a list of books | |
| List<Book> books = Lists.newArrayList(new Book("1234567890"), new Book("0123456789")); | |
| // Convert to GenericEntity and return in response | |
| GenericEntity<List<Book>> entities = new GenericEntity<List<Book>>(books){}; |
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
| Configurar filebeat em JBOSS/Wildfly | |
| 1. Instalar o filebeat | |
| > curl -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-oss-6.3.2-amd64.deb | |
| > dpkg -i filebeat-oss-6.3.2-amd64.deb | |
| 2. Configurar o filebeat | |
| > /etc/filebeat/filebeat.yml |
NewerOlder