Skip to content

Instantly share code, notes, and snippets.

View djekl's full-sized avatar
:octocat:
Working from home

Alan Wynn djekl

:octocat:
Working from home
View GitHub Profile
@djekl
djekl / .htaccess
Created December 12, 2012 15:12
CodeIgniter .htaccess file
#Set the directory index to index.php
DirectoryIndex index.php
#Set the timezone to GMT/UTC
SetEnv TZ UTC
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
@djekl
djekl / AdjustImgOrientation.php
Last active December 11, 2015 09:39
Simple image rotation class
<?php
// in this example we will use a remote file
$file = 'https://raw.github.com/recurser/exif-orientation-examples/master/Landscape_6.jpg';
// adjust orientation and save a local copy (or overrite the origional)
// AdjustImgOrientation::adjust($file, TRUE);
// adjust orientation and display the image
AdjustImgOrientation::adjust($file, FALSE);
@djekl
djekl / djekl_achievements.php
Created January 25, 2013 19:48
Bordem playing with CSS XboxAPI and the XboxAPI Catalog
<html>
<head>
<title>djekl Achievements</title>
<style type="text/css">
body {
text-align: center;
}
.achievement {
function xml2json($url)
{
$fileContents= file_get_contents($url);
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);
$fileContents = trim(str_replace('"', "'", $fileContents));
$simpleXml = simplexml_load_string($fileContents);
$json = json_encode($simpleXml);
return $json;
}
@djekl
djekl / gist:5270080
Created March 29, 2013 10:25
Update all git repos in the ~/projects folder.
alias update_all_git_repos='find ~/projects -name .git -type d -exec sh -c "cd {} && cd .. && pwd && git pull --all --recurse-submodules && echo '\'''\''" \;'
@djekl
djekl / gist:5291592
Created April 2, 2013 11:36
County Array for the UK
$aCounty = array(
"England" => array(
"Avon",
"Bedfordshire",
"Berkshire",
"Borders",
"Bristol",
"Buckinghamshire",
"Cambridgeshire",
"Channel Islands",
@djekl
djekl / Preferences.sublime-settings
Created April 5, 2013 14:56
My Sublime Text 2 Config File
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 50,
"auto_complete_selector": "source - comment",
"auto_complete_size_limit": 4194304,
"auto_complete_triggers":
[
{
"characters": "<",
import sublime, sublime_plugin
# class ExampleCommand(sublime_plugin.TextCommand):
# def run(self, edit):
# self.view.insert(edit, 0, "Hello, World!")
class ConvertTabsToSpaces(sublime_plugin.EventListener):
def on_pre_save(self, view):
edit = view.begin_edit()
view.run_command('expand_tabs', {"set_translate_tabs": True})
@djekl
djekl / uk2usa.php
Last active December 16, 2015 12:19
convert UK date to US date
<?php
/**
* private uk2usa()
* @param string $timestamp UK Date Format (d/m/Y)
* @return string American Date Format (Y-m-d)
*/
private function uk2usa($timestamp = FALSE)
{
if( ! $timestamp)
@djekl
djekl / Summit Awesome tooltip fix.md
Created April 22, 2013 20:08
Summit Awesome tooltip fix