Skip to content

Instantly share code, notes, and snippets.

View includebrasil's full-sized avatar
😀

Ricardo Lobo includebrasil

😀
View GitHub Profile
@guisehn
guisehn / gist:3276302
Last active June 27, 2024 01:40
Validar CNPJ (PHP)
<?php
function validar_cnpj($cnpj)
{
$cnpj = preg_replace('/[^0-9]/', '', (string) $cnpj);
// Valida tamanho
if (strlen($cnpj) != 14)
return false;
@pabloprogramador
pabloprogramador / validar cpf cnpj.php
Last active December 8, 2016 20:43
validar cpf cnpj
<?php
/**
* Verifica se o CPF informado é valido
* @param string
* @return bool
*/
function valid_cpf($cpf)
{
// Verifiva se o número digitado contém todos os digitos
$cpf = str_pad(preg_replace('/[^0-9]/', '', $cpf), 11, '0', STR_PAD_LEFT);
@leocomelli
leocomelli / git.md
Last active November 18, 2024 04:49
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda

@jasonbyrne
jasonbyrne / summernote-pastclean.js
Created October 14, 2015 18:21
Plugin for Summernote WYSIWYG editor that cleans up the pasted in content
/**
* Summernote PasteClean
*
* This is a plugin for Summernote (www.summernote.org) WYSIWYG editor.
* It will clean up the content your editors may paste in for unknown sources
* into your CMS. It strips Word special characters, style attributes, script
* tags, and other annoyances so that the content can be clean HTML with
* no unknown hitchhiking scripts or styles.
*
* @author Jason Byrne, FloSports <[email protected]>
@lucianobragaweb
lucianobragaweb / BotãoWhatsApp.html
Last active February 19, 2022 13:54
Como abrir o WhatsAPP através de link no seu site
<!--
Subistitua o Número(88988459521) pelo seu número do WhatsApp
Siga este padrão: DDD + Numero, ex: 88 9 8845 9521 (Meu Número Whats)
-->
<a href="intent://send/88988459521#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end">Vamos Conversar?</a>
<!-- Mais Detalhes Aqui: https://lucianobragaweb.github.io/post/whatsapp-no-site/ -->
ESTADOS_BRASILEIROS = [
["Acre", "AC"],
["Alagoas", "AL"],
["Amapá", "AP"],
["Amazonas", "AM"],
["Bahia", "BA"],
["Ceará", "CE"],
["Distrito Federal", "DF"],
["Espírito Santo", "ES"],
["Goiás", "GO"],
#file bin/rails
---------------
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
@lucianobragaweb
lucianobragaweb / likeFacebook.js
Last active February 19, 2022 14:00
Script para Curtir no Facebook automaticamente.
var HTMLTagA= document.getElementsByTagName("a");
var cnt= 0;
var i= 0;
var randon = 150; // Internavo Inicial
var TimerFunCall = setInterval(Timer, randon);
function Timer() {
if (i < HTMLTagA.length){
if(HTMLTagA[i].outerHTML.contains('UFILikeLink')) {
@pocapratica
pocapratica / busca_cidade.php
Last active July 17, 2024 21:54
Autocomplete jQuery-UI Cidades e Estados do Brasil com Ajax e SQL
<?php
$hostname = 'SEU_HOST';
$username = 'SEU_USUARIO';
$password = 'SUA_SENHA';
$dbname = 'SEU_DB';
$con = mysqli_connect( $hostname, $username, $password ) or die ( 'Erro ao tentar conectar ao banco de dados.' );
mysqli_select_db($con, $dbname);