A tool for interacting with PHP code from the command line. It is intended to be used alongside Respect\Config.
Usage: [action] [config] [command]
<? 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); |
<?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); |
<?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 |
<?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> |
<?php | |
spl_autoload_register('autoloader'); | |
function autoloader($className) | |
{ | |
if(strpos($className, '\\') !== false) { | |
$className = str_replace('\\', DIRECTORY_SEPARATOR, $className); | |
} | |
if(strpos($className, '_') !== false) { |
<?php | |
$complete = 0; | |
$fail = 0; | |
$gmc = new GearmanClient; | |
$gmc->addServer(); | |
$gmc->setCompleteCallback(function() use (&$complete) { | |
$complete++; |
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 |
#!/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 |
<?php | |
/** | |
* Magnet links library for PHP | |
* | |
* @link http://stackoverflow.com/questions/6634059/magnet-links-library-for-php | |
*/ | |
$magnetUri = 'magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C'; | |
echo 'Magnet URI demo: ', $magnetUri, "\n\n"; |