Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Classe de Banco de Dados com conexão e métodos para cadastro, alteração e exclusão dinâmicos
* @package Sql
*/
class Sql{
public $conn;
private $server = 'localhost';
<?php
/*!
* @AUTHOR João Rangel
* joaohcrangel@gmail.com
*
* Qualquer alteração não autorizada neste arquivo implicará na perda de manutenção e/ou ganrantia de funcionamento do sistema.
*
* Date: 2013-12-19
*/
class Model {
<?php
function __autoload($class){
require_once("class/".strtolower($class).".php");
}
function removeSimplesQuotes($val){
return str_replace("'", "", $val);
}
function request($key){
return removeSimplesQuotes($_REQUEST[$key]);
}
<?php
/* ********************************************************* */
$siteForderName = '';
if($_SERVER["HTTP_HOST"]=="localhost"){
//Instruções
/* Altere a variável ServerAdmin no arquivo httpd.confvdo
* seu apache com o valor do seu e-mail para configurar a
* pasta de desenvolvimento local.
*/
switch($_SERVER['SERVER_ADMIN']){
<?php
class Page {
public $options = array(
"data"=>array(
"js"=>array(),
"title"=>"",
"meta_description"=>"",
"meta_author"=>"João Rangel"
)
int numPin = 13; //número do pino digital no qual LED está conectado
void setup() {
pinMode(numPin, OUTPUT); //declara o pino digital como saída
}
void loop() {
@joaohcrangel
joaohcrangel / alertify.confirm.js
Created September 29, 2015 23:32
Confirmação com alertify antes de uma exclusão.
alertify
.confirm('Você deseja realmente excluir?')
.set('title', 'Confirmação')
.set('onok', function(closeEvent){
rest({
url:PATH+'/rest',
method:"DELETE",
success:function(r){
alertify.success('Excluído com sucesso.');
},
@joaohcrangel
joaohcrangel / validation-cpf.ts
Last active June 25, 2024 15:16
Função para validar CPF em TypeScript
function isValidCPF(value: string) {
if (typeof value !== 'string') {
return false;
}
value = value.replace(/[^\d]+/g, '');
if (value.length !== 11 || !!value.match(/(\d)\1{10}/)) {
return false;
}
function isValidCPF($number)
{
$number = preg_replace('/[^0-9]/', '', (string) $number);
if (strlen($number) != 11)
return false;
for ($i = 0, $j = 10, $sum = 0; $i < 9; $i++, $j--)
$sum += $number{$i} * $j;
const keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
let encode64 = function (input) {
input = escape(input);
var output = "";
var chr1, chr2, chr3 = "";
var enc1, enc2, enc3, enc4 = "";
var i = 0;
do {