Skip to content

Instantly share code, notes, and snippets.

View rbarros's full-sized avatar

Ramon Barros rbarros

  • Tr4ctor Soluções Inteligentes
  • Brazil
View GitHub Profile
@rbarros
rbarros / cpf.js
Last active November 18, 2016 00:15
Validar CPF
// Author: Ramon Barros <[email protected]>
/* jslint devel: true, unparam: true, indent: 4 */
/* global $,document,window,event,url,introJs,XMLHttpRequest,ActiveXObject,onlyNumbers */
function validarCPF(doc) {
'use strict';
var i, cpf = doc.replace(/\D/g, ''), pattern = /^(\d{1})\1{10}$/, sum, mod, digit;
if (cpf.length !== 11) {
return false;
}
@rbarros
rbarros / valida_cnpj.php
Created May 29, 2013 12:36
Valida CNPJ.
<?php
/**
* Verifica se é um número de CNPJ válido.
* @author Gabriel Heming <[email protected]>
* @param $cnpj O número a ser verificado
* @return boolean
*/
public function validar_cnpj( $cnpj ) {
@rbarros
rbarros / validar_cpf.php
Created May 29, 2013 12:31
Validar CPF.
<?php
/**
* Verifica se é um número de CPF válido.
* @author Gabriel Heming <[email protected]>
* @param $cpf O número a ser verificado
* @return boolean
*/
private function validar_cpf( $cpf ) {
$cpf = preg_replace('/\D/', '', $cpf);
@rbarros
rbarros / Services_JSON.php
Created May 15, 2013 20:58
SERVICES JSON
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Converts to and from JSON format.
*
* JSON (JavaScript Object Notation) is a lightweight data-interchange
* format. It is easy for humans to read and write. It is easy for machines
* to parse and generate. It is based on a subset of the JavaScript
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
* This feature can also be found in Python. JSON is a text format that is
@rbarros
rbarros / file1.txt
Created November 26, 2012 12:28
Testing for the gist-embed with multiple files.
file 1
@rbarros
rbarros / 1README.md
Last active November 10, 2023 19:16
Comandos

Comandos utilizados.

@rbarros
rbarros / Example.php
Created October 26, 2012 12:10
TableOrder Classe para ordenação de galerias de fotos e registros em tabela.
<?php
require_once('TableOrder.php');
$tableOrder = new TableOrder();
$startIds = $pagination->startRow+1;
$endIds = $pagination->startRow + $db->RowCount();
$tableOrder->init('fotos',$mainSession,$primaryKey,$startIds,$endIds); // Class TableOrder Jquery UI
@rbarros
rbarros / Contact.class.php
Created October 17, 2012 17:19
Função para envio de contato
<?php
/**
* Contato
*
* @package Neogas
* @category Classes
* @name Contact.class.php
* @author Cristiano T. Fetter
* @version 1.0.0
@rbarros
rbarros / PostgreSQL.php
Created July 13, 2012 20:15
Class connect db PostgreSQL
<?php
/**
* PostgreSQL Application
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package PostgreSQL
* @category Classes
* @author Ramon Barros
@rbarros
rbarros / MySQL.php
Last active October 7, 2015 00:47
Class connect db MySQL
<?php
/**
* MySQL Application
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package MySQL
* @category Classes
* @author Ramon Barros