Skip to content

Instantly share code, notes, and snippets.

View thinkbox's full-sized avatar

Jonno thinkbox

  • Brisbane, Australia
View GitHub Profile
@hubgit
hubgit / self-updating-twitter-oauth-script.php
Created May 20, 2010 17:53
A self-updating Twitter OAuth script
<? php
// Register an app: http://dev.twitter.com/apps
define('CONSUMER_KEY', 'YOUR CONSUMER KEY');
define('CONSUMER_SECRET', 'YOUR CONSUMER SECRET');
define('TWITTER_TOKEN', '{TWITTER_TOKEN}');
define('TWITTER_TOKEN_SECRET', '{TWITTER_TOKEN_SECRET}');
$oauth = new OAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
@hubgit
hubgit / twitter-oauth-pecl.php
Created May 20, 2010 17:58
Command line Twitter OAuth authentication in PHP
<?php
// Register an app: http://dev.twitter.com/apps
define('CONSUMER_KEY', 'YOUR CONSUMER KEY');
define('CONSUMER_SECRET', 'YOUR CONSUMER SECRET');
define('TWITTER_TOKEN', '');
define('TWITTER_TOKEN_SECRET', '');
$oauth = new OAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
@eigan
eigan / itunes_xml_parser.php
Created August 6, 2010 17:09
Itunes php xml parser class
<?php
/**
* Need to get an array of either tracks or playlists from your itunes library?
* yes? then use this shitty code then
*
* Just do like this:
*
* $itunes = new Parse("path/to/your/iTunes Music Library.xml", "all");
*
* The first paramter is (obviously) the xml file
@bobpp
bobpp / com.github.mxcl.homebrew.daemontools.plist
Created February 13, 2011 06:47
daemontools at Mac OS X homebrew
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.mxcl.homebrew.daemontools</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/svscanboot</string>
</array>
@fordnox
fordnox / autoloader.php
Created August 9, 2011 19:52
Simplest possible autoloader for PHP classes. Can be used and for namespaces
<?php
spl_autoload_register('autoloader');
function autoloader($className)
{
if(strpos($className, '\\') !== false) {
$className = str_replace('\\', DIRECTORY_SEPARATOR, $className);
}
if(strpos($className, '_') !== false) {
@hjr3
hjr3 / gearman-client-batch-example.php
Created August 20, 2011 22:27
Gearman client batch job example
<?php
$complete = 0;
$fail = 0;
$gmc = new GearmanClient;
$gmc->addServer();
$gmc->setCompleteCallback(function() use (&$complete) {
$complete++;
@salathe
salathe / results.txt
Created January 24, 2012 20:55
PHP array/string functions haystack/needle ordering
Array functions:
array_search $needle, $haystack
in_array $needle, $haystack
String functions:
strchr $haystack, $needle
stripos $haystack, $needle
stristr $haystack, $needle
strpos $haystack, $needle
strrchr $haystack, $needle
@skyler
skyler / gist:1748751
Created February 6, 2012 01:09
gearmand init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: gearmand
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the gearmand job queue
# Description: starts gearmand using start-stop-daemon
@alganet
alganet / cli.md
Created February 14, 2012 18:20
Respect\Cli

Respect\Cli

A tool for interacting with PHP code from the command line. It is intended to be used alongside Respect\Config.

Main Actions

Usage: [action] [config] [command]

@hakre
hakre / magnet-links-bittorrent.php
Created March 1, 2012 13:13
Magnet links library for PHP