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
// 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() {
<?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();
@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"
@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 / 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" />
#!/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 / EventListener.js
Created October 9, 2014 13:02
EventListener
/*! EventListener - v1.0.0 - 2014-05-30
* Controla os eventos de click
* Copyright (c) 2014 Ramon Barros; Licensed MIT */
(function (root) {
'use strict';
var EventListener = function () {
this.version = '1.0.0';
};
EventListener.prototype.addEvent = function(el, type, fn) {
@rbarros
rbarros / OnBeforeUnLoad.js
Created October 9, 2014 13:05
OnBeforeUnLoad
// include EventListener https://gist.github.com/rbarros/6c7888320ee0cdc3bab7
// include Ajax https://gist.github.com/rbarros/2776240
function OnBeforeUnLoad(e) {
e.preventDefault();
var ajax = Ajax.open({
method: 'GET',
url: 'http://localhost/',
dataType: 'json',
//data: { id: 1 },
success: function (json) {
@rbarros
rbarros / lista_palavras.c
Last active August 29, 2015 14:13
Exemplos em C/C++
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
void main() {
char aux[256], *words[50], *pTmp;
int c, i;
// Lê string
@rbarros
rbarros / correios.md
Last active August 29, 2015 14:20
Serviços mais utilizados nos correios.