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 / addvhost.sh
Created October 2, 2012 14:17
Used within BASH Shell to add virtual hosts
#!/bin/sh
## clear the output
clear
## auth the sudo command
sudo -p "Please enter you admin password: " whoami 1>/dev/null
if [ "$(sudo whoami)" != 'root' ]; then
echo "You entered an invalid password or you are not an admin/sudoer user!\n\nScript aborted"
exit 1;
@djekl
djekl / dabblet.css
Created October 3, 2012 08:13 — forked from daneden/dabblet.css
<i> Cloud
/* <i> Cloud */
html {
min-height: 100%;
background: linear-gradient(#b4bcbf, #fff);
}
.cloud {
display: inline-block;
background-color: #fff;
@djekl
djekl / dabblet.css
Created October 9, 2012 08:37 — forked from lensco/dabblet.css
box-shadow vs filter: drop-shadow 2
/**
* box-shadow vs filter: drop-shadow 2
*/
body {
background: #ddd;
font: 16px/1 sans-serif;
margin: 50px;
text-align: right;
{
// save before running commands
"save_first": true
// if present, use this command instead of plain "git"
// e.g. "/Users/kemayo/bin/git" or "C:\bin\git.exe"
,"git_command": false
// point this the installation location of git-flow
,"git_flow_command": "/usr/local/bin/git-flow"
@djekl
djekl / README.md
Created October 22, 2012 21:03 — forked from mikedfunk/README.md
CodeIgniter Pagination for Twitter Bootstrap

This uses Twitter Bootstrap classes for CodeIgniter pagination.

Drop this file into application/config.

@djekl
djekl / download_file.php
Created November 1, 2012 17:30
Simple PHP download script. Can be adapted to include SQL code for download analytics etc.
<?php
function output_file($file, $name, $mime_type='')
{
/*
This function takes a path to a file to output ($file),
the filename that the browser will see ($name) and
the MIME type of the file ($mime_type, optional).
If you want to do something on download abort/finish,
@djekl
djekl / psn_friends.php
Created November 10, 2012 20:11 — forked from meg87/psn_friends.php
PHP class to access PlayStation Network friends list.
<?php
// Disable libxml errors and allow user to fetch error information as needed
libxml_use_internal_errors(true);
class PSN_friends
{
public $log_file, $session, $frineds;
function __construct()
{
@djekl
djekl / get_key.php
Created November 13, 2012 15:29 — forked from joostvanveen/get_key.php
Helper function that returns the value for a key in an array or a property in an object. No more endless isset() statements.
<?php
/**
* Return the value for a key in an array or a property in an object.
* @param mixed $haystack
* @param string $needle
* @param mixed $default_value The value if key could not be found.
* @return mixed
*/
function get_key ($haystack, $needle, $default_value = '')
{
@djekl
djekl / gist:4066383
Created November 13, 2012 15:36
<?php print_r(getCoordinates('6-8 Charlotte Square, Newcastle upon Tyne, NE1 4XF'));
<?php
/**
* private getCoordinates()
*/
private function getCoordinates($address = false)
{
if (!$address) {
return false;
}
@djekl
djekl / gist:4153916
Created November 27, 2012 12:08
This function tries to cope with as many numerical time and date formats as possible
public function epoch($_value = "", $_format = "Y-m-d H:i:s")
{
// Description: This function tries to cope with as many numerical time and date
// formats as possible.
// Parameters:
// $_value: The time and/or date string (dd-mm-yyy, yyy-mm-dd, hh:mm:ss etc).
// $_format: The output format options (same as PHP "date" function).
$epoch = 0;
$pm = '';