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 / 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 / SagaWebSocket.js
Last active April 13, 2018 17:08
Classe SagaWebSocket
/*!
* Classe SagaWebSocket
*
* @author Ramon Barros [[email protected]]
* @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 <[email protected]>
# 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 / banco.c
Last active September 19, 2016 03:06
Trabalho de Grau A - Estrutura de Dados
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
#include <locale.h>
/**
Autor: Diego Ribeiro
@rbarros
rbarros / backup.sh
Last active September 4, 2016 17:51
#!/bin/bash
#
# Identificação dos arquivos
IDENTIFICA=Backup
# Numero de dias do ciclo de backup
DIAS=7
# E-mail do administrador
[email protected]
@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 / mysql_secure.sh
Created June 1, 2016 13:49 — forked from enoch85/mysql_secure.sh
Automating mysql_secure_installation for MySQL 5.7
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10
@rbarros
rbarros / vagrant-start.bat
Last active February 1, 2016 17:59
Vagrant VM start bat
@echo off
CD /d \path\dir\vagrant
FOR /f "tokens=2 delims= " %%a in ('vagrant status ^| find /i "default"') do (
SET STATE=%%a
)
IF %STATE% equ "running" (
@echo Vagrant VM is running...