Skip to content

Instantly share code, notes, and snippets.

View billhance's full-sized avatar

Bill Hance billhance

  • Startup
  • Los Angeles
View GitHub Profile
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class CI_Session
{
var $flash_key = 'flash'; // prefix for "flash" variables (eg. flash:new:message)
function __construct()
{
$this->_sess_run();
@billhance
billhance / gist:1386513
Created November 22, 2011 18:50
CSV to Array function
<?php
function csv_to_array($csv,$has_headings=false,$delimiter=',',$enclosure='"',$escape="//",$eol="\n")
{
$headings = null;
$data = array();
$csv = str_getcsv($csv, $eol); // Array containing each line
if(empty($csv[0]))
{
@billhance
billhance / gist:3036863
Created July 3, 2012 01:16 — forked from nikita2206/gist:3035134
If String Contains
<?php
if(!function_exists('if_string_contains'))
{
function if_string_contains($needle,$haystack) {
if (is_array($needle)) {
foreach ($needle as $n) {
if (strpos($haystack, $n) !== false) {
return true;

PHP Developer Interview: What you should know

###1. What’s the difference between " self " and " this " ?

Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.

Source: When to use self vs this -stackoverflow

@billhance
billhance / hl-pr.js
Last active December 25, 2015 17:49
alert('This is just an example.');
Apr 29 14:27:44 prod-workflow1 php-fpm: pool www[5482]: PHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /opt/halo-symfony/releases/2/vendor/twig/twig/lib/Twig/Node.php on line 138
Apr 29 14:27:44 prod-workflow1 php-fpm: pool www[5482]: PHP Stack trace:
Apr 29 14:27:44 prod-workflow1 php-fpm: pool www[5482]: PHP 1. {main}() /opt/halo-symfony/releases/2/workflow/web/app.php:0
Apr 29 14:27:44 prod-workflow1 php-fpm: pool www[5482]: PHP 2. AppKernel->handle() /opt/halo-symfony/releases/2/workflow/web/app.php:29
Apr 29 14:27:44 prod-workflow1 php-fpm: pool www[5482]: PHP 3. Symfony\Component\HttpKernel\Kernel->handle() /opt/halo-symfony/releases/2/workflow/app/AppKernel.php:64
Apr 29 14:27:44 prod-workflow1 php-fpm: pool www[5482]: PHP 4. Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle() /opt/halo-symfony/releases/2/workflow/app/bootstrap.php.cache:2245
Apr 29 14:27:44 prod-workflow1 php-fpm: pool www[5482]: PHP 5. Symfony\Component\HttpKe
@billhance
billhance / .gitignore
Last active August 29, 2015 14:20 — forked from octocat/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@billhance
billhance / .gitconfig
Last active August 29, 2015 14:26 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@billhance
billhance / Mac Dev Setup.md
Last active August 28, 2015 04:58 — forked from ogrrd/Mac Dev Setup.md
Installing nginx, PHP and MySQL on OS X Mavericks

Installing a Web Developer setup on OS X Mavericks

Install Command Line Tools

This is a requirement for brew in the next step. You can install XCode and then install Command Line Tools through the XCode preferences, or you can install just the Command Line Tools.

Install Command Line Tools

$ xcode-select --install