Skip to content

Instantly share code, notes, and snippets.

View reginaldojunior's full-sized avatar

Reginaldo Junior reginaldojunior

View GitHub Profile
@guisehn
guisehn / gist:3276302
Last active April 3, 2024 13:24
Validar CNPJ (PHP)
<?php
function validar_cnpj($cnpj)
{
$cnpj = preg_replace('/[^0-9]/', '', (string) $cnpj);
// Valida tamanho
if (strlen($cnpj) != 14)
return false;
@ricardobarantini
ricardobarantini / estados.php
Last active December 12, 2023 19:04
Array com nome e siglas de estados Brasileiros para select do Codeigniter
$estadosBrasileiros = array(
'AC'=>'Acre',
'AL'=>'Alagoas',
'AP'=>'Amapá',
'AM'=>'Amazonas',
'BA'=>'Bahia',
'CE'=>'Ceará',
'DF'=>'Distrito Federal',
'ES'=>'Espírito Santo',
'GO'=>'Goiás',
@cgiovanii
cgiovanii / laravel_migration_tutorial.md
Last active September 1, 2018 23:24
laravel: Comandos migrate do artisan para criar tabelas

Criar tabelas com o artisan:migrate

php artisan migrate:make create_filmes_table --table=filmes --create

/app/database/migrations/xxx_create_filmes_table.php
<?php

use Illuminate\Database\Schema\Blueprint;
@kacole2
kacole2 / CSS
Created November 3, 2014 13:42
Phonegap Cordova Geolocation with Google Maps Javascript API v3
* {
-webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
}
html, body {
width: 100%;
height: 100%;
padding-top: 10%;
}
@rudwolf
rudwolf / estados.php
Last active August 10, 2016 17:55
Array associativa de estados brasileiros com sigla pra chave e nome para valor para uso em PHP
<?php
$estados = array(
"AC"=>"Acre",
"AL"=>"Alagoas",
"AM"=>"Amazonas",
"AP"=>"Amapá",
"BA"=>"Bahia",
"CE"=>"Ceará",
"DF"=>"Distrito Federal",
"ES"=>"Espírito Santo",
@renatoargh
renatoargh / bematech.js
Created August 29, 2016 02:57
Imprimindo com Bematech MP-4200 com node.js (sem cups nem módulos nativos)
var fs = require('fs');
String.prototype.toBytes = function() {
var arr = []
for (var i=0; i < this.length; i++) {
arr.push(this[i].charCodeAt(0))
}
return arr;
}
@rafael-neri
rafael-neri / validar_cpf.php
Last active April 27, 2024 21:49
Validar CPF em PHP (Completo)
<?php
function validaCPF($cpf) {
// Extrai somente os números
$cpf = preg_replace( '/[^0-9]/is', '', $cpf );
// Verifica se foi informado todos os digitos corretamente
if (strlen($cpf) != 11) {
return false;
@SanderTheDragon
SanderTheDragon / postman-deb.sh
Last active May 25, 2024 09:02
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
# SPDX-FileCopyrightText: 2017-2024 SanderTheDragon <sanderthedragon@zoho.com>
#
# SPDX-License-Identifier: MIT
arch=$(dpkg --print-architecture)
echo "Detected architecture: $arch"
case "$arch" in
@wellingtonpgp
wellingtonpgp / setup.sh
Last active October 9, 2017 21:16
setup sh para usar vagrant e docker com ruby on rails
RUBY_VERSION="2.4.0"
RAILS_VERSION="5.0.2"
MYSQL_PASSWORD="123456"
GIT_USER_NAME="wellingtongeek"
GIT_USER_EMAIL="wellingtongeek@gmail.com"
NODE_VERSION="6"
echo
@callmeloureiro
callmeloureiro / comoSerChatoNoWhatsapp.js
Last active January 15, 2024 20:44
Como fazer alguém te responder no whatsapp
/*
Hoje iremos MUDAR a vida da pessoa que não te responde no whatsappp...
Que tal enviar mensagens pra ela até obter uma resposta?!
Sensacional não acha?! Mas, somos devs, correto?! Então vamos automatizar esse paranauê!
Para utilizar:
- Abra o web.whatsapp.com;
- Selecione a conversa que você quer;
- Abra o console e cole o código que está no gist;