function formatCnpjCpf($value)
{
$CPF_LENGTH = 11;
$cnpj_cpf = preg_replace("/\D/", '', $value);
if (strlen($cnpj_cpf) === $CPF_LENGTH) {
return preg_replace("/(\d{3})(\d{3})(\d{3})(\d{2})/", "\$1.\$2.\$3-\$4", $cnpj_cpf);
}
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.awt.BorderLayout; | |
import java.awt.Dimension; | |
import java.awt.FlowLayout; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import javax.swing.JButton; | |
import javax.swing.JLabel; | |
import javax.swing.JPanel; | |
import javax.swing.JWindow; | |
import javax.swing.UIManager; |
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.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
public class WindowsProcessKiller { | |
// command used to get list of running task | |
private static final String TASKLIST = "tasklist"; | |
// command used to kill a task | |
private static final String KILL = "taskkill /IM "; |
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.InputMismatchException; | |
import java.util.Scanner; | |
public class Um { | |
public static void main(String[] args) { | |
Scanner ler = new Scanner(System.in); | |
double vlr; | |
System.out.printf("Informe um valor em R$: "); |
Disponível em: https://dev.to/juniormartinxo/como-habilitar-a-assinatura-automatica-de-commits-do-git-com-gnupg-gpg-no-windows-26o9
Este é um guia para habilitar git commits
com assinatura GPG
no GitHub.
"O GnuPG é um programa de software de criptografia híbrida porque usa uma combinação de criptografia de chave simétrica convencional por questões de velocidade e criptografia de chave pública para facilitar a troca segura de chaves, geralmente usando a chave pública do destinatário para criptografar uma chave de sessão que é usada apenas uma vez. Este modo de operação faz parte do padrão OpenPGP e faz parte do PGP desde sua primeira versão."
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
public static void abrirGaveta() { | |
javax.print.DocPrintJob dpj = PrinterService.getImpressoraPadrao().createPrintJob(); | |
javax.print.DocFlavor flavor = javax.print.DocFlavor.BYTE_ARRAY.AUTOSENSE; | |
//byte[] bematech = new byte[]{(byte) 29, (byte) 249, (byte) 32, (byte) 0, (byte) 27, (byte) 118, (byte) 140}; | |
byte[] epson = new byte[]{(byte) 27, (byte) 112, (byte) 0, (byte) 10, (byte) 100}; | |
javax.print.Doc doc = new javax.print.SimpleDoc(epson, flavor, null); | |
try { | |
dpj.print(doc, null); | |
//JOptionPane.showMessageDialog(null, "Gaveta aberta!", "Atenção", JOptionPane.INFORMATION_MESSAGE); |