Skip to content

Instantly share code, notes, and snippets.

@caionitro
caionitro / tempoGasto.php
Last active September 12, 2016 12:45
script para medir o tempo gasto do arquivo/sistema.
<?php
$time = microtime(TRUE);
function formatPeriod($endtime, $starttime)
{
$duration = $endtime - $starttime;
$hours = (int) ($duration / 60 / 60);
$minutes = (int) ($duration / 60) - $hours * 60;
$seconds = (int) $duration - $hours * 60 * 60 - $minutes * 60;
return ($hours == 0 ? "00":$hours).":".($minutes == 0 ? "00":($minutes < 10? "0".$minutes:$minutes)).":".($seconds == 0 ? "00":($seconds < 10? "0".$seconds:$seconds));
<?php
$novadata = implode('-', array_reverse(explode('-', $date)));
@caionitro
caionitro / installphp7.sh
Created April 15, 2016 03:00 — forked from tronsha/installphp7.sh
Install PHP7 to Ubuntu
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get update
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev make
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7
@caionitro
caionitro / Sublime Text 3 Build 3103 License Key - CRACK
Created March 2, 2016 14:19
Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
@caionitro
caionitro / Dockerfile
Created December 9, 2015 01:50
docker com centos6, apache, php, nodejs, npm, bower, composer
FROM centos:centos6
MAINTAINER Caio Mariano
RUN yum -y update;
RUN yum -y install httpd;
RUN yum -y install php php-mbstring php-mysql;
RUN curl --silent --location https://rpm.nodesource.com/setup | bash -;
RUN yum -y install nodejs;
RUN npm install -g npm@latest;
@caionitro
caionitro / index.html
Last active September 4, 2015 12:02
Swipe com Slick, usando slider com multi gestos.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./slick/slick/slick.css"/>
<link rel="stylesheet" type="text/css" href="./slick/slick/slick-theme.css"/>
<title></title>
<style type="text/css">
.tamanho{
font-size: 35px;
border: solid 1px black;
@caionitro
caionitro / regex.js
Created December 30, 2014 19:47
letters and numbers regex
var letters = /^[A-Za-z]+$/;
var numbers = /^[0-9]+$/;
if(name.match(letters) && name.length <=15){
alert("do something!");
}else{
alert("Please Enter Name in Alphabet only...");
}
if(price.match(numbers) && price.length <=5){
@caionitro
caionitro / datedb.php
Created December 18, 2014 11:27
funcao para alterar data do banco
<?php
$dt = date("d/m/Y h:i:s", strtotime($dados["dt_bd"]));
@caionitro
caionitro / getset.php
Created September 20, 2014 17:39
métodos mágicos
<?php
public function __get($property)
{
if(!property_exists($this,$property))
{
throw new InvalidArgumentException("Propriedade {$property} inexistente!");
}
return $this->$property;
}
@caionitro
caionitro / server.js
Created September 11, 2014 12:35
API Transparência
var http = require('http');
var api = {
path : function(estado,cargo,partido,nome){
var api = '/api/v1/candidatos?estado='+estado+'&cargo='+cargo;
if(partido != null){
api += '&partido='+partido;
}
if(nome != null){