Skip to content

Instantly share code, notes, and snippets.

View adampatterson's full-sized avatar
:octocat:

Adam Patterson adampatterson

:octocat:
View GitHub Profile
@adampatterson
adampatterson / git_pull
Created October 17, 2011 20:27
Git pull Helper
/**
* Git Pull
*
* @author Adam Patterson
* http://www.adampatterson.ca/blog/2011/10/diy-simple-staging-server/
*
* Use: echo pull();
*/
function pull ( )
@adampatterson
adampatterson / columns
Created December 16, 2011 18:04
Columns
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Columns</title>
<style type="text/css" media="screen">
.container{
width: 75%;
display: block;
}
@adampatterson
adampatterson / inkdit.php
Created August 28, 2012 21:16
Inkdit Class
<?php
/*
// Ussage:
// documentation of this process and these example values are taken from
// https://inkdit.desk.com/customer/portal/articles/685178
require 'inkdit.php';
@adampatterson
adampatterson / php-upgrade.php
Created August 31, 2012 16:57
PHP Upgrade Script
<?
define('APP_PATH', __DIR__.'/');
function delete_dir($dir) {
if (substr($dir, strlen($dir)-1, 1) != '/')
$dir .= '/';
if ($handle = opendir($dir))
{
while ($obj = readdir($handle))
CREATE TABLE 'users' (
'id' bigint(20) unsigned NOT NULL AUTO_INCREMENT,
'email' varchar(100) NOT NULL DEFAULT '',
'username' varchar(60) NOT NULL DEFAULT '',
'password' varchar(64) NOT NULL DEFAULT '',
'type' varchar(25) DEFAULT NULL,
'data' text,
PRIMARY KEY ('id')
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
@adampatterson
adampatterson / gist:3961278
Created October 26, 2012 20:26
recursive_glob
/**
* Function: recursive_glob
* Recursively goes through a folder and returns all files.
*
* Parameters:
* $pattern - String
* $flags - Boolean
* $path - String
*
* Returns:
@adampatterson
adampatterson / gist:3961595
Created October 26, 2012 21:18
tentacle-appfog
<? if(!defined('DINGO')){die('External Access to File Denied');}
if ( getenv( "VCAP_SERVICES" ) ) {
$services_json = json_decode(getenv("VCAP_SERVICES"),true);
$mysql_config = $services_json["mysql-5.1"][0]["credentials"];
$username = $mysql_config["username"];
$password = $mysql_config["password"];
$hostname = $mysql_config["hostname"];
$db = $mysql_config["name"];
.container {
display: block;
width: 80%;
margin: 60px auto;
}
.clearfix {
*zoom: 1;
&:before,
&:after {
@adampatterson
adampatterson / next-post
Created June 13, 2013 19:57
Provides Next/Previous single custom post navigation.
<?php
/*
Plugin Name: Next Post
Plugin URI: http://adampatterson.ca
Description: Provides shortcodes and template tags for next/previous navigation in custom post types.
Version: 1
License: GPLv2
Author: Adam Patterson
Author URI: http://adampatterson.ca
*/
// Load this as part of your Bootstrap mixins.less make sure to also compile the responsive.less if needed.
// Adds centered columns.
/*
<div class="row">
<div class="center6">
<div class="span3">3</div>
<div class="span3">3</div>
</div>
</div>