Skip to content

Instantly share code, notes, and snippets.

View tuliofaria's full-sized avatar

Tulio Faria tuliofaria

View GitHub Profile
<?php
function montaHorario($horaMin=7, $minMin=0, $horaMax=22, $minMax=45, $default=""){
$montaHorario = '';
for($hora=$horaMin; $hora<=$horaMax; $hora++){
$horaStr = str_pad($hora, 2, "0", STR_PAD_LEFT);
$startMin = 0;
if($hora==$horaMin){
$startMin = $minMin;
}
$endMin = 45;
@tuliofaria
tuliofaria / gist:9374340
Created March 5, 2014 19:12
Assinando um JAR.
Gerar keystore:
keytool -genkey -alias ivprog -keystore ivprog
Assinar:
jarsigner -keystore ivprog -storepass 123456 iVProg2.jar ivprog
<?php
function latest(){
return $this->Medicine->find("all", array("limit"=>10)); // seu find normal aqui
}
?>
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema ultranegocio
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `ultranegocio` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
USE `ultranegocio` ;
<?php
class Extensao extends AppModel{
public $useTable = "extensoes";
}
@tuliofaria
tuliofaria / gist:0ad0c6d20c43d7271c4d
Created January 13, 2015 13:50
Exemplo de closure
function umaClosure(name){
var x = 0;
// metodos privados
function contar(){
console.log("Contei "+name," ", x++);
}
// metodos publicos
return {
cont: contar
}
@tuliofaria
tuliofaria / index.js
Created January 13, 2015 16:58
Modules
var modulo1 = require('./modulo1');
modulo1.escreva();
modulo1.escreva();
modulo1.escreva();
var modulo2 = require('./modulo2');
var m2 = modulo2("M2");
m2.conta();
m2.conta();
@tuliofaria
tuliofaria / com_q.js
Created January 14, 2015 03:48
Promises com Q
// promises
var q = require("q")
var fs = require('fs');
var filename = "dados.txt";
function lerDados(filename){
var defer = q.defer();
fs.readFile(filename, 'utf8', function(err, data) {
//defer.resolve(data);
#!/bin/bash
yum install -y gcc libpng libjpeg libpng-devel libjpeg-devel ghostscript libtiff libtiff-devel freetype freetype-devel
wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-1.3.9.tar.gz
tar zxvf GraphicsMagick-1.3.9.tar.gz
cd GraphicsMagick-1.3.9
./configure --enable-shared
make
@tuliofaria
tuliofaria / app.js
Created April 29, 2015 21:07
Uma organizadinha no Angular.JS
var app = angular.module("app", ["appControllers"]);