Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
* Licensed under the Open Software License version 3.0
*
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
* Licensed under the Academic Free License version 3.0
*
<?php
class DisplayHook
{
public function captureOutput()
{
$this->CI =& get_instance();
$output = $this->CI->output->get_output();
if (ENVIRONMENT != 'testing') {
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="true"
stopOnFailure="false"
backupGlobals="false"
backupStaticAttributes="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
<?php
/*
*---------------------------------------------------------------
* APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*/
define('ENVIRONMENT', 'testing');
<?php
class PostTest extends PHPUnit_Framework_TestCase
{
private $CI;
public function setUp()
{
$this->CI = &get_instance();
$this->CI->load->database('testing');
<?php
class Post extends CI_Model
{
public function getAll()
{
$query = $this->db->get('posts');
$posts = array();
foreach ($query->result_array() as $row) {
@willmendesneto
willmendesneto / example-ajax-ci.js
Created April 8, 2013 19:23
exemplo de uma requisição ajax a um método de um controller no framework Codeigniter PHP
// BASE_URL é uma variável javascript que pega o valor da função 'base_url()' do CI
$.post(BASE_URL + 'C_app/pedido',
{
status: status,
id: id
}, function(data){
alert(result);
}, 'html');
@willmendesneto
willmendesneto / Twig.php
Created April 11, 2013 12:14
Library para trabalhar com Twig no Framework Codeigniter
<?php if (!defined('BASEPATH')) {exit('No direct script access allowed');}
class Twig {
/**
* Referência da instância da classe CodeIgniter
*
* @var object
*/
protected $CI;
@willmendesneto
willmendesneto / Preferences.sublime-settings
Last active December 16, 2015 06:19
Meu arquivo de preferências no Sublime Text 2 - "Preferences.sublime-settings"
{
"color_scheme": "Packages/User/Twilight (SL).tmTheme",
"default_line_ending": "unix",
"detect_indentation": true,
"fallback_encoding": "UTF-8",
"font_size": 10,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[