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 / 1README.md
Last active November 10, 2023 19:16
Comandos

Comandos utilizados.

@rbarros
rbarros / cep.php
Created October 7, 2021 00:12
Adianti Framework - Busca Cep
<?php
public function onCep($param)
{
$obj = new Cliente; // create an empty object
$obj->fromArray( (array) $param); // load the object with data
if (!empty($obj->cep)) {
$cep = preg_replace('/\D/', '', $obj->cep);
$rest = @file_get_contents(
"https://viacep.com.br/ws/{$cep}/json/"
<?php
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
/**
* Slim 3.x shipped with the Pimple container implementation and enabled the following synthax
*/
$app = new \Slim\App([...]);
@rbarros
rbarros / laravel-dev.sh
Last active November 7, 2018 15:08
Install laravel
#!/bin/bash
{ # This ensures the entire script is downloaded
ROOT_UID=0
ARRAY_SEPARATOR="#"
OS=""
OS_VERSION=""
PROJECT=""
PACKAGE=""
@rbarros
rbarros / fix1.sh
Created February 12, 2015 20:29
This script remove malware of PHP files.
#!/bin/bash
#
# This script remove malware of PHP files.
#
# In this case it will remove some malicious code
# from all Wordpress PHP files that is at top of
# every PHP file.
#
# The string at the top of every file is:
#
@rbarros
rbarros / SagaWebSocket.js
Last active April 13, 2018 17:08
Classe SagaWebSocket
/*!
* Classe SagaWebSocket
*
* @author Ramon Barros [contato@ramon-barros.com]
* @date 2018-03-16
* Copyright (c) 2018 Ramon Barros
*/
/* jslint devel: true, unparam: true, indent: 2 */
(function (window, $, Promise) {
'use strict';
@rbarros
rbarros / .bash_aliases
Created June 23, 2017 13:48
Configuration of the BASH for Arch Linux.
# File: ~/bash_aliases
# Author: Oliver Michels <oliver.michels@gmx.net>
# Desc: Definition of some useful aliases for the bash
# Some common shortcuts for file-/directory commands
alias ls='ls --color=auto'
alias la='ls -a'
alias ll='ls -l'
alias lla='ls -la'
alias l='ls'
@rbarros
rbarros / FormData.js
Created January 26, 2017 18:37
Emulate FormData for some browsers
/**
* Emulate FormData for some browsers
* MIT License
* (c) 2010 François de Metz
*/
/* jslint devel: true, unparam: true, quotmark: double, indent: 2 */
(function(w) {
"use strict";
if (w.FormData) {
return;
@rbarros
rbarros / lib.js
Created May 23, 2012 16:19
Template para criação de Plugins e Bibliotecas javascript
/*!
* Name JavaScript Plugin/Library v0.0.0
* http://public.ramon-barros.com/
*
* Copyright 2012, Ramon Barros
* Licensed
*
* Includes .js
* http://.com/
* Copyright 2011,
@rbarros
rbarros / cpf.js
Last active November 18, 2016 00:15
Validar CPF
// Author: Ramon Barros <contato@ramon-barros.com>
/* 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;
}