Skip to content

Instantly share code, notes, and snippets.

View benedmunds's full-sized avatar

Ben Edmunds benedmunds

View GitHub Profile
@benedmunds
benedmunds / gist:2415063
Created April 18, 2012 17:04
Ion Auth - get users groups
$this->data['users'] = $this->ion_auth->users()->result();
foreach ($this->data['users'] as $k => $user)
{
$this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
}
@benedmunds
benedmunds / gist:2424724
Created April 19, 2012 22:50
Customized spacelab bootstrap css
/*!
* Bootstrap v2.0.2
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
article,
@benedmunds
benedmunds / gist:2783232
Created May 24, 2012 18:17
Shitty way to remove dups from a php array
foreach ($arr1 as $k => $v)
{
if (array_search($v, $arr2) !== FALSE)
unset($arr1[$k])
}
@benedmunds
benedmunds / gist:2881995
Created June 6, 2012 13:55
Ion Auth - Restrict emails when registering
//MODEL
class users_m()
{
function restrict_email()
{
$emails = array('test@test.com', 'test2@test2.com');
$this->db->where_in($emails);
}
}
@benedmunds
benedmunds / MY_Session.php
Created July 15, 2013 23:14
MY_Session to enable native PHP sessions in CodeIgniter
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session extends CI_Session
{
public function __construct($params = array())
{
log_message('debug', "Session Class Initialized");
// Set the super object to a local variable for use throughout the class
$this->CI =& get_instance();
@benedmunds
benedmunds / gist:6530884
Created September 11, 2013 22:52
Home Brew - Script to switch between PHP 5.3 and 5.4
#!/bin/bash
# php switch for homebrew
# $ brew tap josegonzalez/php && brew install php53 --with-mysql && brew install php54 --with-mysql
# Might as well ask for password up-front, right?
sudo -v
VERSION_FILE="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/php-switch.version"
curl -s http://moviecommit.com/clean | xargs -0I {} git commit -m 'Your commit message' -m "{}"
@benedmunds
benedmunds / gist:9798806
Created March 27, 2014 02:29
Hacky PHP Switch script
#!/bin/bash
# php switch for homebrew
# $ brew tap josegonzalez/php && brew install php53 --with-mysql && brew install php54 --with-mysql
# modified from original basic script from somewhere on the interweb, I don't remember where
# Might as well ask for password up-front, right?
sudo -v
@benedmunds
benedmunds / gist:10347729
Created April 10, 2014 06:26
Create gMaps Marker dynamically with PHP
<?php
$c = $_GET['color'];
$t = $_GET['text'];
$cHex = str_split($c, 2);
header("Content-Type: image/png");
$im = @imagecreate(40, 40)
or die("Cannot Initialize new GD image stream");
$x1 = 5;
<div class="foo bar"></div>
<div class="foo raa"></div>