Skip to content

Instantly share code, notes, and snippets.

View adampatterson's full-sized avatar
:octocat:

Adam Patterson adampatterson

:octocat:
View GitHub Profile
<?
if ( have_posts() ):
echo '<!-- '.$post->post_name.'-->';
if ( is_front_page() ):
get_template_part('templates/content', 'home');
else:
if ( file_exists(get_template_directory().'/templates/content-'.$post->post_name.'.php'))
get_template_part('templates/content', $post->post_name);
else
get_template_part('templates/content', 'page');
(function($) {
var o = $( {} );
$.each({
trigger: 'publish',
on: 'subscribe',
off: 'unsubscribe'
}, function( key, val ) {
jQuery[val] = function() {
o[key].apply( o, arguments );
@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 {