Skip to content

Instantly share code, notes, and snippets.

@phplaw
phplaw / CI_Loader_helper.php
Created February 2, 2015 10:18
CI Loader Helper
<?php
public function helper($helpers = array())
{
foreach ($this->_ci_prep_filename($helpers, '_helper') as $helper)
{
if (isset($this->_ci_helpers[$helper]))
{
continue;
}
@phplaw
phplaw / heredoc.php
Created November 13, 2014 03:28
PHP Tips & Tricks
<?php
$mystring = <<<EOT
This is some PHP text.
It is completely free
I can use "double quotes"
and 'single quotes',
plus $variables too, which will
be properly converted to their values,
you can even type EOT, as long as it
is not alone on a line, like this:
- Defining a field
- hook_field_info()
- hook_field_schema()
- hook_field_validate()
- hook_field_is_empty()
- Defining a formatter for the field (the portion that outputs the field for display)
- hook_field_formatter_info()
- hook_field_formatter_view()
- Defining a widget for the edit form
- hook_field_widget_info()
@phplaw
phplaw / backbonejs_todo.md
Last active August 29, 2015 14:08
Backbonejs Todo Example.

todos.js

// An example Backbone application contributed by
// [Jérôme Gravel-Niquet](http://jgn.me/). This demo uses a simple
// [LocalStorage adapter](backbone-localstorage.html)
// to persist Backbone models within your browser.

// Load the application once the DOM is ready, using `jQuery.ready`:
$(function(){
@phplaw
phplaw / PhpStorm_CI_autocomplete.php
Last active August 29, 2015 14:07
Setting CI Autocomplete for PhpStorm 8
<?php
die('This file is not really here!');
/**
* ------------- DO NOT UPLOAD THIS FILE TO LIVE SERVER ---------------------
*
* Implements code completion for CodeIgniter in phpStorm
* phpStorm indexes all class constructs, so if this file is in the project it will be loaded.
* -------------------------------------------------------------------
* Drop the following file into a CI project in phpStorm
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session extends CI_Session{
private $sess_use_redis = TRUE;
private $redis = '';
public function __construct($params = array()) {
//parent::__construct();
$this->CI =& get_instance();
<?php
function pr($var) { echo '<pre>' .print_r($var, true). '</pre>'; }
$array = array(
(object) array('title'=>'a','ordering'=>2),
(object) array('title'=>'x','ordering'=>0),
(object) array('title'=>'r','ordering'=>4),
(object) array('title'=>'b','ordering'=>21),
(object) array('title'=>'b1','ordering'=>21),
(object) array('title'=>'q','ordering'=>6),
(object) array('title'=>'o','ordering'=>7),
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Input extends CI_Input {
/**
* Variables
*
*/
protected $delete;