Instantly share code, notes, and snippets.

View jquery.validade
function formValidate() {
$.validator.addMethod("pattern", function(value, element) {
return this.optional(element) || /^\(\d{2}\)\s\d{4,5}-\d{4}$/.test(value);
});
$('#form').validate({
rules: {
nome: "required",
email: {
required: true,
View recaptcha.doc
// Site
https://www.google.com/recaptcha/intro/android.html
// Doc
https://developers.google.com/recaptcha/docs/verify
View sass.mquery.ex1
$tablet: 768px;
@mixin tablet {
@media (max-width: #{$tablet}) {
@content;
}
}
p {
font-size: 18px;
View limpar campos
$('form').submit(function(){
$(this)[0].reset();
});
View HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form id="myform" method="post">
<input type="text" id="nome" name="nome" placeholder="nome">
View isOnScreen
function isOnScreen(el) {
var win = $(window);
var winTop = win.scrollTop();
var winBottom = winTop + win.height();
var elTop = el.offset().top;
var elBottom = elTop + el.height();
return winTop <= elBottom && winBottom >= elTop;
View modal.css
* { margin: 0; padding: 0; }
.content-modal {
width: 800px;
height: 400px;
background: #fff;
margin-left: -400px;
margin-top: -200px;
position: absolute;
left: 50%;
View java.criptografia
import java.math.BigInteger;
import java.security.*;
public static void main(String[] args) {
String texto = "admin";
Criptografar(texto);
}
public static void Criptografar(String str) {
try {
View java.regex
import java.util.regex.*;
public static void main(String[] args) {
String texto = "_Java Netbeans_";
String regex = "[\\W_]"; // Expressao Regular ([\W_] = Não é permitido caracter especial)
Pattern p = Pattern.compile(regex);
if(!"".equals(texto)) {
for(int i = 0; i < texto.length(); i++) {
char c = texto.charAt(i);
String conversao = Character.toString(c);
View sqlserver.conexao
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
public class Connect {
public Statement stm; // Responsavel por preparar e realizar pesquisas no banco de dados;
public ResultSet rs; // Responsavel por armazenar o resultado de um pesquisa passada para o statement;
private String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
private String caminho = "jdbc:sqlserver://localhost:1433;databaseName=control"; // O "control" representa a minha database