Skip to content

Instantly share code, notes, and snippets.

View pedroppinheiro's full-sized avatar

Pedro Victor Pontes Pinheiro pedroppinheiro

View GitHub Profile
@pedroppinheiro
pedroppinheiro / jsf.md
Created June 4, 2018 14:20 — forked from franzwong/jsf.md
Jsf cheatsheet
  • usage of h:selectOneMenu
<h:selectOneMenu value="#{manageStudent.student.gender}">
    <f:selectItem itemLabel="- Select Gender -" itemValue=""/>
    <f:selectItems value="#{manageStudent.genders}"/>
</h:selectOneMenu>
  • get HttpServletRequest and HttpServletResponse in managed bean
#./easy_install.exe requests
import requests
jogos = requests.get('http://worldcup.sfg.io/matches').json()
for jogo in jogos:
if jogo['status'] in ('completed', 'in progress'):
print(
'['+jogo['status'].upper()+']',
@pedroppinheiro
pedroppinheiro / youmightnotneedjquery.html
Created October 11, 2018 18:10
youmightnotneedjquery
<!DOCTYPE html>
<html>
<head>
<style>
#square {
width: 100px;
height: 100px;
background: red;
position: relative;
}
@pedroppinheiro
pedroppinheiro / docker-commands.md
Last active December 30, 2018 04:08
Informações coletadas durante aprendizado do docker

Comandos Docker

  • https://labs.play-with-docker.com/ - Site em que é possível utilizar os comandos do docker e testar as diversas funcionalidades que o Docker proporciona.

  • docker version - exibe a versão do docker.

  • docker run NOME_DA_IMAGEM - cria um container com a respectiva imagem passada como parâmetro.

  • docker run hello-world - Imagem de hello-world utilizada para um teste rápido e que simplesmente exibe uma mensagem no terminal e encerra o container

  • docker ps - lista todos os containers ativos no momento

  • docker ps -a - lista todos os containers ja criados inclusive os parados

  • docker rm NOME_DA_IMAGEM - remove um ou mais containers

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pedroppinheiro
pedroppinheiro / create_thumbnail.php
Last active June 21, 2019 17:14
This php funtion creates a thumbnail of an image. It supports JPEG, JPG, PNG and GIF formats and can be used to define a specific background color, including transparent when dealing with PNG.
<?php
/**
* This code is an improvement over Alex's code that can be found here -> http://stackoverflow.com/a/11376379
*
* This funtion creates a thumbnail with size $thumbnail_width x $thumbnail_height.
* It supports JPG, PNG and GIF formats. The final thumbnail tries to keep the image proportion.
*
* It has been pointed out that if the thumbnail already exists it doesn't get overwritten, but the method still returns true.
* so keep an eye on that.
*
@pedroppinheiro
pedroppinheiro / validar.php
Created September 1, 2016 00:13
Classe que ajuda na validação de campos
<?php
/**
* Exemplo de utilização:
* $regras = array(
* Validar::Required($situacao_id, 'Preencha o campo de Situação!'),
* Validar::Required($empregado_nome, 'Preencha o campo Nome!'),
* Validar::Required($empregado_cpf, 'Preencha o campo CPF!'),
* Validar::Required($empregado_base_id, 'Selecione uma base!'),
* Validar::Required($empregado_data_admissao, 'Insira a data de admissão do empregado!'),
* Validar::EmpregadoCodigoNaoExistente($empregado_codigo, 'O Código já pertence a um empregado!'),
@pedroppinheiro
pedroppinheiro / schemaspy_config.file
Last active August 28, 2019 15:15
schemaspy config and generation command
#Command: java -jar ./schemaspy-6.0.0.jar -configFile C:/Users/pedro/Desktop/schemaspy/schemaspy_config.file
# type of database. Run with -dbhelp for details
schemaspy.t=mssql08
# optional path to alternative jdbc drivers.
#schemaspy.dp=path/to/drivers
schemaspy.dp=C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssql-jdbc-7.4.1.jre8.jar # esse jar é baixado do site da microsoft
# database properties: host, port number, name user, password
schemaspy.host=localhost
schemaspy.port=1433
@pedroppinheiro
pedroppinheiro / treinamento docker e kubernets - 21-11-2019.txt
Last active November 22, 2019 20:40
treinamento docker banpará - leandro vibe
sudo su
sudo apt update && apt list --upgradable
apt install openjdk-8-jdk
apt install maven
curl -fsSL https:/get.docker.com | bash
docker version
docker container run hello-world
@pedroppinheiro
pedroppinheiro / git_metrics.md
Last active December 20, 2019 17:27
Collection of git comands that can generate useful or interesting metrics about your git repo