This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Simon Holywell <treffynnon@php.net> | |
*/ | |
class LazyLoadingProxy { | |
/** | |
* Where the instance of the actual class is stored. | |
* @var $instance object | |
*/ | |
private $instance = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Treffynnon; | |
/** | |
* A PHP class to access a PHP array via dot notation | |
* (Agavi http://www.agavi.org was the inspiration). | |
* | |
* This was hacked in to an existing codebase hence the | |
* global config array variable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Requires pandoc to be installed and in your path | |
* | |
* It will look for .rst files in __DIR__/content/* where it will expect to find | |
* category folders. Inside these category folders your posts should be available. | |
* | |
* So | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
exec('schtasks /Delete /TN taskname /F'); | |
exec('schtasks /Create /RU username /RP password /SC MINUTE /MO 2 /TN taskname /TR “C:\Program Files\wget\wget.exe --header=TASK_KEY:my-secret-key –U my-agent http://www.webaddress.com/script.php -r'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
RewriteBase / | |
# force url to lowercase | |
RewriteCond %{REQUEST_URI} [A-Z] | |
# ensure it is not a file on the drive first | |
RewriteCond %{REQUEST_FILENAME} !-s | |
RewriteRule (.*) rewrite-strtolower.php?rewrite-strtolower-url=$1 [QSA,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<PCMS xmlns="http://www.auspost.com.au/xml/pcms"> | |
<SendPCMSManifest> | |
<header> | |
<TransactionDateTime>2010>01-13T16:30:00.0Z</TransactionDateTime> | |
<TransactionId>1</TransactionId> | |
<TransactionSequence>1</TransactionSequence> | |
<ApplicationId>MERCHANT</ApplicationId> | |
</header> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$allowable_ips = array( | |
'192.168.0.', | |
'8.8.8.8', | |
); | |
$is_allowed = (bool) array_filter($allowable_ips, function($value) { | |
return (substr($_SERVER['REMOTE_ADDR'], 0, strlen($value)) == $value); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- In the HTML of your posts: Replace ID number with ID of your gist --> | |
<p class="embed_gist"><a href="http://gist.github.com/367154">http://gist.github.com/367154</a></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "This script will download and install the tumblr migration script" | |
echo "script and its dependencies on Debian systems." | |
echo " " | |
read -p "Install dependencies from apt-get? [Yn] " | |
if [ "$REPLY" == "" -o "$REPLY" == "y" -o "$REPLY" == "Y" ]; then | |
echo "Installing the dependencies..." | |
echo " " | |
sudo apt-get install libxslt-dev libxml2-dev ruby rubygems pandoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function (req, http_res) { | |
http_res.writeHead(200, {'Content-Type': 'text/plain'}); | |
var response = ''; | |
var cradle = require('cradle'); | |
var connection = new(cradle.Connection)('https://subdomain.iriscouch.com', 443, { | |
auth: { username: 'username', password: 'password' } | |
}); |
NewerOlder