Skip to content

Instantly share code, notes, and snippets.

View chrismeller's full-sized avatar

Chris Meller chrismeller

View GitHub Profile
@chrismeller
chrismeller / gzdeflate.php
Created September 7, 2012 23:50
Test PHP ZLib Methods for Compressing HTTP Requests
<?php
header('Content-Encoding: deflate' );
echo gzdeflate( 'this is just a test!' );
?>
@chrismeller
chrismeller / gist:2162569
Created March 22, 2012 19:33
The Problematic View
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Service</th>
<th>Account Number</th>
<th>Invoice Number</th>
<th>Report Date</th>
<th>Customer Name</th>
<th>Invoice Amount</th>
<th>Deduct</th>
@chrismeller
chrismeller / vhost.com
Created January 10, 2012 20:52
Standard Nginx Vhost
server {
include listen_80;
server_name vhost.com;
include /etc/nginx/fastcgi_params;
access_log /home/chris/public_html/vhost.com/logs/access.log;
error_log /home/chris/public_html/vhost.com/logs/error.log;
root /home/chris/public_html/vhost.com/public;
@chrismeller
chrismeller / theme.php
Created November 19, 2011 22:59
Habari Theme Updates for Page Caching
<?php
/**
* @package Habari
*
*/
/**
* Habari Theme Class
*
* The Theme class is the behind-the-scenes representation of
@chrismeller
chrismeller / gist:1339633
Created November 4, 2011 15:44
Github Packager
<?php
class Github_Packager {
private static $api_endpoint = 'http://github.com/api/v2/json/';
private static $temp_path = './temp/';
public static function list_branches ( $addon_name, $with_commits = false ) {
$url = self::$api_endpoint . 'repos/show/habari-extras/' . $addon_name . '/branches';
<?php
class Model_Browser extends Model {
public function list_schemas ( $like = null ) {
$query = \DB::select( array( 'table_schem', 'schema' ) )->from( 'sysibm.sqltables' );
if ( $like != null ) {
$query->where( 'table_schem', 'like', $like );
<?php
foreach ( $posts as $post ) {
// save the post for the area to use
$theme->post = $post;
echo $theme->area( 'foo' );
}
@chrismeller
chrismeller / gist:1318490
Created October 27, 2011 00:56
Habari Change Homepage Content Type
<?php
class Foo extends Theme {
public function act_display_home ( $user_filters = array() ) {
$user_filters['content_type'] = Post::type( 'foo' );
parent::act_display_home( $user_filters );
@chrismeller
chrismeller / gist:1293165
Created October 17, 2011 17:22
Fuel Cache Example
<?php
private function add_external_assets ( ) {
$url = 'http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css';
try {
$content = Cache::get( md5( $url ) );
}
catch ( CacheNotFoundException $e ) {
@chrismeller
chrismeller / gist:1246516
Created September 27, 2011 23:08
Habari IIS Rewrite Rules
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Match Valid Files" stopProcessing="true">
<match url="^.*$" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_FILENAME}" matchType="IsFile" pattern="" ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" pattern="" ignoreCase="false" />