This file contains 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
// faz uma requisiço do tipo post e o response dessa requisição é o PDF | |
this.fetch(`blog.clairtonluz.com.br/gerarPDF`, {method: 'POST'}) | |
.then(response => response.blob()) | |
.then(file => { | |
// Precisa gerar um novo blob para poder definir o tipo como application/pdf caso contrário quando o arquivo | |
// for aberto pelo navegador vai ser exibido em texto plano ao invés de PDF | |
const pdf = new Blob([file], {type: 'application/pdf'}); | |
// Criar uma url local para o arquivo baixado. | |
const url = window.URL.createObjectURL(pdf); | |
// abre o pdf utilizando a url local do arquivo. |
This file contains 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
<?php defined('BASEPATH') OR exit('No direct script access allowed'); | |
/* | |
* | |
* _________ Codeigniter 3 Autocomplete for PHPStorm ____________ | |
* | |
1) Controllers | |
2) Models | |
3) Create named properties for your application Models, |
This file contains 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
# instala ntpdate | |
sudo apt install ntpdate -y | |
# atualiza a hora baseada no servidor definido | |
sudo ntpdate -u ip_ou_dominio_do_servidor_ntp | |
# edita o arquivo /etc/default/ntpdate substituindo o NTPSERVERS padrão pelo seu servidor ntp | |
sudo sed -i '10s/.*/NTPSERVERS="ip_ou_dominio_do_servidor_ntp"/' /etc/default/ntpdate |
This file contains 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
#!/bin/bash | |
if [[ $(whoami) != 'root' ]]; then | |
echo 'Execute o comando como super usuário: "sudo proxy-config.sh"' | |
exit 1 | |
fi | |
echo Digite o endereço ip ou dominio do proxy | |
read PROXY | |
echo Digite a porta do proxy |
This file contains 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
#!/bin/bash | |
# | |
# PostgreSQL Backup Script Ver 1.0 | |
# http://autopgsqlbackup.frozenpc.net | |
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com> | |
# | |
# This script is based of the AutoMySQLBackup Script Ver 2.2 | |
# It can be found at http://sourceforge.net/projects/automysqlbackup/ | |
# | |
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9 |
This file contains 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
npm i -g npm-check-updates | |
npm-check-updates -u | |
npm install |
This file contains 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
export PATH="$PATH:$(yarn global bin)" |
This file contains 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
import javax.persistence.AttributeConverter; | |
import javax.persistence.Convert; | |
@Converter | |
public class BooleanToStringConverter implements AttributeConverter<Boolean, String> { | |
@Override | |
public String convertToDatabaseColumn(Boolean value) { | |
return value ? "S" : "N"; | |
} |
This file contains 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
@Entity | |
public class Cliente { | |
@Convert(converter=BooleanToStringConverter.class) | |
private Boolean ativo; | |
... | |
} |
This file contains 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
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Scanner; | |
public class Application { | |
public static void main(String[] args) { | |
Scanner leitor = new Scanner(System.in); |