Skip to content

Instantly share code, notes, and snippets.

View MateusAndraste's full-sized avatar

Mateus André MateusAndraste

  • Foraleza, Ceará
View GitHub Profile
@MateusAndraste
MateusAndraste / dio-ruby-07
Created March 27, 2023 20:12
Webscraping com Nokogiri
# gem install nokogiri
require 'nokogiri'
require 'net/http'
https = Net::HTTP.new('example.com', 443)
https.use_ssl = true
response = https.get('/')
@MateusAndraste
MateusAndraste / dio-ruby-06
Created March 27, 2023 18:03
Usar regex para validar telefone informado
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?
@MateusAndraste
MateusAndraste / dio-ruby-04
Created March 25, 2023 15:17
Desafio ruby POO Digital Innovation One
# Product
class Product
attr_accessor :description, :price
def initialize(description, price)
@description = description
@price = price
end
end
@MateusAndraste
MateusAndraste / dio-ruby-03
Created March 24, 2023 16:32
Desafio Programa para Consulta de CPF com Ruby
# 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'
@MateusAndraste
MateusAndraste / dio-ruby-02
Created March 24, 2023 14:31
Desafio Cálculo com Potência em Ruby
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)
@MateusAndraste
MateusAndraste / dio-ruby-01
Created March 24, 2023 01:05
Resolução de atividade do exercício de ruby da Digital Innovation One
# 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)"
@MateusAndraste
MateusAndraste / jax-rs-list of-entities.java
Created February 4, 2022 17:47 — forked from leifoolsen/jax-rs-list of-entities.java
JAX-RS: Return a list of entities in a response
@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){};
@MateusAndraste
MateusAndraste / README-TEMPLATE.md
Created November 8, 2021 21:10 — forked from reginadiana/README-TEMPLATE.md
Template sugestivo para documentação de projetos

Titulo ou Arte do Projeto

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
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