Skip to content

Instantly share code, notes, and snippets.

Ben Edmunds benedmunds

Block or report user

Report or block benedmunds

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@benedmunds
benedmunds / gist:9798806
Created Mar 27, 2014
Hacky PHP Switch script
View gist:9798806
#!/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 Apr 10, 2014
Create gMaps Marker dynamically with PHP
View gist:10347729
<?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;
View Result
<li class="gig ng-scope">
<div class="month september-2014">
<h2>April</h2>
<h3>2014</h3>
</div>
<div class="info-container">
<div class="info">
<div class="calendar">
<div class="monthtop ng-binding">Apr
<img ng-src="/dist/img/flags/GB.png" src="/dist/img/flags/GB.png">
View gist:10500084
$scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) {
$('.month').each(function(){
//grab the classes
var classes = $(this).attr('class').split(/\s+/);
for (var i=0; i<classes.length; i++) {
//only check against the date classes
if (/\w*-\d{4}/.test(classes[i])) {
//show the first matching element
$('.'+classes[i]).first().show();
View gist:2a84a0410f81aea33281
<?php
/**
* ----------------------------------------------------
* Info:
* ----------------------------------------------------
* @author Tim Joosten
* @package Ion Auth 3
*
* Description: The english language file for Ion Auth 3
View gist:b6f532e331cf9577aaec
public function onData($data, MessageInterface $message = null, callable $onMessage, callable $onControl = null, $context = null) {
RECURSE:
$overflow = '';
$onControl ?: $this->noop;
$message ?: $message = $this->newMessage();
$prevFrame = null;
$frameCount = count($message);
if ($frameCount > 0) {
$frame = $message[$frameCount - 1];
if ($frame->isCoalesced()) {
View gist:6b2d4a148233334e6865
$(element).find('input[type=radio], input[type=checkbox]').each(function()
{
var tIndexChangeHandler = function()
{
var selected_element = $(this);
obj.validate(element,function(obj){
var tab = $(selected_element).closest('div[data-role=page]');
var idx = Number($(tab).attr('t_index'));
@benedmunds
benedmunds / gist:2415063
Created Apr 18, 2012
Ion Auth - get users groups
View gist:2415063
$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 Apr 19, 2012
Customized spacelab bootstrap css
View gist:2424724
/*!
* 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
Shitty way to remove dups from a php array
View gist:2783232
foreach ($arr1 as $k => $v)
{
if (array_search($v, $arr2) !== FALSE)
unset($arr1[$k])
}
You can’t perform that action at this time.