Skip to content

Instantly share code, notes, and snippets.

View collegeman's full-sized avatar

Aaron Collegeman collegeman

View GitHub Profile
@collegeman
collegeman / setup-statsd.sh
Created March 9, 2011 16:12
Turn an Ubuntu 10.04 linode into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use
@collegeman
collegeman / Handler.php
Last active September 5, 2022 06:59
Boilerplated files for Lumen-based WordPress plugins
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
@collegeman
collegeman / xfdf.php
Created August 20, 2011 13:55
Generate xFDF in PHP
<?php
/*
KOIVI HTML Form to FDF Parser for PHP (C) 2004 Justin Koivisto
Version 1.1
Last Modified: 2010-02-17
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
@collegeman
collegeman / fix-missed-schedule.php
Created April 16, 2012 02:05
A simple drop-in for fixing Missed Schedules in WordPress
<?php
// Based on: http://wordpress.org/extend/plugins/wp-missed-schedule/
@define('MISSED_SCHEDULE_DELAY', 5);
@define('MISSED_SCHEDULE_OPTION', 'wp_missed_schedule');
function fix_missed_schedule() {
global $wpdb;
// check to see if the publishing window is up again...
#!/usr/bin/env python
#
# webkit2png.py
#
# Creates screenshots of webpages using by QtWebkit.
#
# Copyright (c) 2008 Roland Tapken <roland@dau-sicher.de>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
<?php
/**
* Given a URL, normalize that URL.
* @param String URL
* @return String Normalized URL
*/
function normalizeUrl($url)
{
$newUrl = "";
$url = parse_url($url);
@collegeman
collegeman / HttpBinClient.php
Last active January 2, 2020 18:28
Using a trait to add an API client to any PHP class
<?php
namespace Tests\Feature;
use App\Concerns\MakesRequests;
class HttpBinClient
{
use MakesRequests;
protected $config = [
@collegeman
collegeman / TicTacToe.php
Created August 12, 2019 19:52
Games are coming... XOXO. <3
<?php
namespace Games;
use Arcade;
use App\User;
use Games\Models\Game;
use Illuminate\Http\Request;
class TicTacToe extends Cabinet {
@collegeman
collegeman / fresh-install.mkd
Created April 29, 2010 19:57 — forked from kennethreitz/fresh-install.mkd
Fresh installation hit list for Mac OSX developers
@collegeman
collegeman / google-analytics-keywords.js
Created November 1, 2012 14:26
Get a list of individual organic search keywords, sorted by frequency, from the Google Analytics UI
// step 1: Open Google Analytics to Traffic Sources => Sources => Search => Organic
// step 2: Change "Show rows" field to 500
// step 3: Open the JS console, and run the following script
var s = document.createElement('script'); s.src = '//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'; document.getElementsByTagName('body')[0].appendChild(s);
var text = jQuery('td.sf span').map(function(i, el) { return jQuery(el).text(); });
// step 4: Then run this one:
var words = {};