Skip to content

Instantly share code, notes, and snippets.

View rcaneppele's full-sized avatar

Rodrigo da Silva Ferreira Caneppele rcaneppele

  • Alura
  • Brasília
View GitHub Profile
@rcaneppele
rcaneppele / Estudante.java
Created May 6, 2024 11:52
Mapeamento ManyToMany com colunas adicionais na JPA
@Entity
@Table(name = "estudantes")
public class Estudante {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String nome;
//outros atributos...
@rcaneppele
rcaneppele / Estudante.java
Created May 6, 2024 11:33
Mapeamento ManyToMany com JPA
@Entity
@Table(name = "estudantes")
public class Estudante {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String nome;
//outros atributos...
@rcaneppele
rcaneppele / Escritor.java
Last active November 21, 2018 14:43
Exemplo de uso dos principios SOLID
public interface Escritor {
void escrever(String linha);
}
@rcaneppele
rcaneppele / livros.txt
Last active October 11, 2017 14:23
FJ-91 - Livros
* Refactoring: Improving the Design of Existing Code
https://www.amazon.com.br/Refactoring-Improving-Design-Existing-Code/dp/0201485672
* Clean Code: A Handbook of Agile Software Craftsmanship
https://www.amazon.com.br/Clean-Code-Handbook-Software-Craftsmanship-ebook/dp/B001GSTOAM
* Domain-Driven Design: Tackling Complexity in the Heart of Software
https://www.amazon.com.br/Domain-Driven-Design-Tackling-Complexity-Software-ebook/dp/B00794TAUG
* Implementing Domain-Driven Design
@rcaneppele
rcaneppele / CSPFilter.java
Last active October 5, 2017 16:02
Filtro para definir Header CSP
@WebFilter("/*")
public class CSPFilter implements Filter {
private static final String POLICY = "default-src 'none';"
+ "base-uri 'self';"
+ "font-src 'self';"
+ "form-action 'self';"
+ "img-src 'self';"
+ "media-src 'none';"
+ "object-src 'none';"
@rcaneppele
rcaneppele / CandleStickFactoryTest.java
Last active September 27, 2017 12:30
FJ-22 - CandlestickFactory com Java 8 e Testes de Unidade
public class CandleStickFactoryTest {
@Test
public void deveriaCriar3CandlesParaNegociacoesEmTresDiasDistintos() {
Calendar hoje = Calendar.getInstance();
Negociacao negociacao1 = new Negociacao(40.5, 100, hoje);
Negociacao negociacao2 = new Negociacao(45.0, 100, hoje);
Negociacao negociacao3 = new Negociacao(39.8, 100, hoje);
Negociacao negociacao4 = new Negociacao(42.3, 100, hoje);
@rcaneppele
rcaneppele / AutorizadorRequestFilter.java
Created March 11, 2016 21:43
JAX-RS AutorizadorRequestFilter
import java.io.IOException;
import javax.annotation.Priority;
import javax.ws.rs.Priorities;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.Provider;
@rcaneppele
rcaneppele / header-flex.html
Created December 10, 2015 18:45
Header da Mirror Fashion com Flexbox
<!DOCTYPE html>
<html>
<head>
<title>Mirror Fashion</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="css/reset.css" />
<style>
.menu-opcoes li {
display: inline;
@rcaneppele
rcaneppele / script.sh
Last active August 5, 2019 13:57
Instalacao do Composer e do Laravel no Linux
#Comando para baixar o composer:
curl -sS https://getcomposer.org/installer | php
#Comando para adicionar o comando composer ao terminal
sudo mv composer.phar /usr/local/bin/composer
#Comando para criar novo projeto laravel via composer
composer create-project laravel/laravel projeto "5.4.*" --prefer-dist
@rcaneppele
rcaneppele / form.xhtml
Last active November 19, 2015 12:29
JSF 2.2 HTML5 Friendly
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<head jsf:id="head">
<title>Cadastro de Cliente</title>
<script jsf:target="head" jsf:name="app.js" />
<link jsf:name="estilos.css" rel="stylesheet" type="text/css" />
</head>
<body jsf:id="body">