Skip to content

Instantly share code, notes, and snippets.

@ahutchings
ahutchings / gist:25834
Created November 17, 2008 17:32
Gnip Push Recipient
<?php
// Database connection information
$host = 'localhost';
$user = 'gnip';
$pass = 'gnip';
$db = 'gnip';
$table = 'activity';
// Read raw post data
@ahutchings
ahutchings / gist:51340
Created January 24, 2009 05:00
Graphical PHP_CodeSniffer results
<?php
// temp dir
$temp_dir = 'c:/windows/temp/';
// construct the filename
$temp_file = $temp_dir."phpcs-".time().".tmp";
// get the argument
$to_check = $argv[1];
@ahutchings
ahutchings / phpcs_format.php
Created January 24, 2009 05:06
HTML Formatting of PHP_Codesniffer XML Results
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8" />
<title>PHP_CodeSniffer</title>
<style type="text/css">
div {
font-family: arial;
font-size: 0.9em;
@ahutchings
ahutchings / igoogle_lite.user.js
Created March 23, 2009 16:32
Greasemonkey script that removes unnecessary sections from iGoogle.
// ==UserScript==
// @name iGoogle Lite
// @namespace http://userscripts.org/users/84491
// @description Removes unnecessary sections from iGoogle.
// @include http://google.tld/ig*
// @include http://*.google.tld/ig*
// @include https://*.google.tld/ig*
// @include https://google.tld/ig*
// ==/UserScript==
@ahutchings
ahutchings / googleanalytics.plugin.php
Created April 21, 2009 18:03
Modification of Habari's Google Analytics plugin to allow for caching the tracking file locally. Should also validate as real XHTML.
<?php
class GoogleAnalytics extends Plugin {
function info()
{
return array(
'url' => 'http://iamgraham.net/plugins',
'name' => 'GoogleAnalytics',
'description' => 'Automatically adds Google Analytics code to the bottom of your webpage.',
'license' => 'Apache License 2.0',
'author' => 'Graham Christensen',
// ==UserScript==
// @name Better Hiveminder
// @namespace http://gist.github.com/163081
// @include http://*hiveminder.com/*
// ==/UserScript==
GM_addStyle(<><![CDATA[
body {
font-family:"Arial",Helvetica,Helvetica Neue,Verdana,sans-serif;
}
Stack::add('template_stylesheet', array(Site::get_url('theme').'/style.css', 'screen'), 'style');
<key>IOPCIMatch</key>
<string>0x71461002 0x71421002 0x71091002...</string>
pear install PHP_CodeSniffer
cd PROJECT_DIRECTORY
PATH_TO_PHP_CODESNIFFER --tab-width=4 --report=xml . > phpcs.xml