Skip to content

Instantly share code, notes, and snippets.

View jlamim's full-sized avatar
👨‍💻
Working and having fun

Jonathan Lamim jlamim

👨‍💻
Working and having fun
View GitHub Profile
@jlamim
jlamim / database.sql
Created April 28, 2016 15:34
Autenticação de usuário com controle de acesso - SQL
# Tabela que armazenará os métodos
CREATE TABLE `metodos` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`classe` varchar(50) DEFAULT NULL,
`metodo` varchar(50) DEFAULT NULL,
`identificacao` varchar(100) DEFAULT NULL,
`privado` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@jlamim
jlamim / Base.php
Last active June 8, 2016 21:30
Exemplo de controllar para cache de páginas
<?php
class Base extends CI_Controller {
public function Index() {
$this->output->cache(10);
$this->load->view('pagina_em_cache');
}
public function Remove_cache() {
$this->output->delete_cache('cache');
@jlamim
jlamim / pagina_em_cache.php
Created June 8, 2016 21:13
View da página que ficará armazenada em cache
<!DOCTYPE html>
<html lang="pt_BR">
<head>
<meta charset = "utf-8">
<title>Criando cache de páginas com CodeIgniter</title>
</head>
<body>
<h1>Essa página vai ficar no cache por 10 minutos.</h1>
@jlamim
jlamim / Welcome.php
Last active June 9, 2016 15:25
Gráfico simples com CodeIgniter e PHPlot
public function Index(){
// Carregamos a library PHPlot
$this->load->library('PHPlot');
//Definindo os dados do gráfico
$dados = array(
array('a',3),
array('b',5),
array('c',7),
array('d',8),
@jlamim
jlamim / Welcome.php
Last active June 9, 2016 15:25
Gráficos com títulos (CodeIgniter + PHPlot)
public function Comtitulos()
{
$this->load->library('PHPlot');
//Define os títulos
$this->phplot->SetTitle("Titulo do Grafico");
$this->phplot->SetXTitle('Eixo X');
$this->phplot->SetYTitle('Eixo Y');
//Define os valores para geração do gráfico
@jlamim
jlamim / Base.php
Last active June 10, 2016 12:39
__construct - Integrando a biblioteca PHPExcel com COdeIgniter
<?php
function __construct(){
parent::__construct();
$this->load->library('PHPExcel');
}
?>
@jlamim
jlamim / Base.php
Last active June 10, 2016 12:52
Index - Integrando a biblioteca PHPExcel com OCdeIgniter
<?php
public function Index()
{
// Definindo o nome do arquivo (repare no uso da extensão .php, ela será substituída posteriormente por .xls ou .xlsx)
$fileName = "PHPExcelFile.php";
// Definindo o path de salvamento do arquivo
$saveFilePATH = "./files/".$fileName;
// Cria um novo objeto
@jlamim
jlamim / Base.php
Last active June 10, 2016 12:50
Formulas - Integrando a biblioteca PHPExcel com CodeIgntier
<?php
public function Formulas()
{
// Definindo o nome do arquivo (repare no uso da extensão .php, ela será substituída posteriormente por .xls ou .xlsx)
$fileName = "PHPExcelFormulas.php";
// Definindo o path de salvamento do arquivo
$saveFilePATH = "./files/".$fileName;
// Cria um novo objeto PHPExcel
@jlamim
jlamim / index.php
Created June 16, 2016 19:49
index.php - Controle de erros
/*
*---------------------------------------------------------------
* ERROR REPORTING
*---------------------------------------------------------------
*
* Different environments will require different levels of error reporting.
* By default development will show errors but testing and live will hide them.
*/
switch (ENVIRONMENT)
{
@jlamim
jlamim / constants.php
Created June 16, 2016 20:11
constants.php - Exit Status Code
/*
|--------------------------------------------------------------------------
| Exit Status Codes
|--------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still