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
#!/usr/bin/sh
# Scipt for installing mcrypt.so extension for PHP 5.3.13 (default PHP for OS X 10.8 Mountain Lion)
mkdir /tmp/gettext
cd /tmp/gettext
curl --location --progress-bar http://br1.php.net/get/php-5.3.29.tar.gz/from/this/mirror | tar -zx
brew update
@rbarros
rbarros / array.php
Last active August 9, 2016 16:06
PHP Coding Standards - PSR-2
<?php
$array = array(
'nivel1' => array(
'nivel1.1' => 1,
'nivel1.2' => 'string',
'nivel1.3' => array(
'nivel1.3.1' => 'string',
'nivel1.3.2' => array(
'nivel1.3.2.1' => function () {
return 'Closure';
@rbarros
rbarros / web.config
Created July 3, 2014 18:17
web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
@rbarros
rbarros / files.py
Created April 17, 2014 21:01
Executar php -l em todos os arquivos de um projeto.
#!/usr/bin/env python
import os
import subprocess
class ArrayInterator:
path = '/var/www/project/'
ext = '.php'
@rbarros
rbarros / jsonsql.js
Last active August 29, 2015 13:57
jsonsql
var pages = [
{
"id": 1,
"slug": "empresa",
"page": "Empresa",
"title": "Empresa",
"subtitle": "Sub Empresa",
"text": "",
"created_at": "2013-07-12 12:15:25",
"updated_at": "2014-02-27 10:28:20"
<?php
/**
* Requisição Ajax public/js/main.js:111
* Busca informações de cep (endereco, bairro, cidade e uf)
* @url POST /carrinho/cep
* @return json retorna um json para o script
*/
function cep($cep=null)
{
$input = Input::all();
// Exemplo 04: Acenda e apague um LED gradualmente, produzindo um
// efeito como aquele que vemos em um computador Apple em suspensão
const int LED = 9; // pino para o LED
int i = 0; // Utilizamos essa variável para contagem
void setup() {
pinMode(LED, OUTPUT); // Diz ao Arduino que LED é uma saída
}
void loop() {

Platform game engine

A simple platform game engine, the map is customisable and scriptable. Refer to the comments in the "map" variable for instructions.

I plan to expand the engine in the future, the ability to use images for tiles and the player is one thing that I have in mind. Any suggestions are welcome.

A Pen by suffick on CodePen.

License.

@rbarros
rbarros / Tearable-Cloth.markdown
Created November 21, 2013 15:33
A Pen by suffick.
@rbarros
rbarros / cnpj.js
Last active November 18, 2016 00:14
Validar CNPJ
// Author: Ramon Barros <[email protected]>
/* jslint devel: true, unparam: true, indent: 4 */
/* global $,document,window,event,url,introJs,XMLHttpRequest,ActiveXObject,onlyNumbers */
function validarCNPJ(doc) {
'use strict';
var i, cnpj = doc.replace(/\D/g, ''), pattern = /^(\d{1})\1{13}$/, soma, multiplicador, digitoUm, digitoDois;
if (cnpj.length !== 14) {
return false;
}
if (pattern.test(cnpj)) {