Skip to content

Instantly share code, notes, and snippets.

View collegeman's full-sized avatar

Aaron Collegeman collegeman

View GitHub Profile
@collegeman
collegeman / gist:1361275
Created November 12, 2011 23:16
Squidmags video player
<?php
$vids_config = array(
'http://youtube.com/?v=whatever This is my first title',
'http://youtube.com/?v=whatever This is my second title',
'http://youtube.com/?v=whatever This is my third title
);
foreach($vids_config as $vid) {
$parts = explode(' ', $vid);
$url = array_shift($parts);
@collegeman
collegeman / base_facebook.php
Created September 1, 2011 13:21
The Facebook PHP SDK, using WP_Http instead of CURL - very experimental.
<?php
/**
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@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.
<?php
$apis = clApi::exec(array(
'http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=squidoo',
'http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=github',
));
$statuses = clApi::grep($apis, 'status', 'date,desc:created_at');
<?php
/*
WordPress Force Upgrade Script
Copyright (C) 2006 Mark Jaquith
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
@collegeman
collegeman / old-date
Created June 30, 2011 18:52
Compare post date to cut off date (for layouts)
<?php
$postDate = strtotime( $post->post_date );
$oldDate = strtotime( '2011-06-29' );
if ( $postDate > $oldDate ) {
echo 'do the new thing';
} else {
echo 'do the old thing';
}
@collegeman
collegeman / db.js
Created May 24, 2011 06:03
The simplest possible database toolkit for Appcelerator Mobile
/*
The simplest possible database toolkit for Appcelerator Mobile.
Copyright (C)2011 Fat Panda, LLC.
Aaron Collegeman [email protected]
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
@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 / example1.php
Created February 27, 2011 16:57
Several examples for using the Attachments WordPress Plugin
<?php foreach(Attachments::getPosts() as $post) { ?>
<ul>
<?php foreach(Attachments::get($post) as $file) { ?>
<li><a href="<?php echo $file->url ?>"><?php echo apply_filters('the_title', $post->post_title) ?></a></li>
<?php } ?>
</ul>
<?php } ?>
@collegeman
collegeman / functions.php
Created February 26, 2011 22:56
The best way to hide the new WordPress admin bar from subscribers and other non-administrative users
<?php
// in functions.php
show_admin_bar(!is_admin() && current_user_can('edit_posts'));