Skip to content

Instantly share code, notes, and snippets.

<?php
Interface WeatherInterface {
public function getWeather();
}
class WeatherBot implements WeatherInterface {
public function getWeather() {
// imagine something more complicated
return 'Sunny';
sudo http_proxy="http://wwwcache.lmu.ac.uk:3128" aptitude install curl
# add to .bashrc:
export http_proxy="http://wwwcache.lmu.ac.uk:3128"
@lornajane
lornajane / gist:3756788
Created September 20, 2012 16:03
My First Form
<form method="post">
Name: <input type="text" name="name" />
<br />
<input type="submit" />
</form>
<?
if($_POST) {
echo "Hello, " . filter_input(INPUT_POST, "name", FILTER_SANITIZE_STRING);
@lornajane
lornajane / file1.txt
Created September 25, 2012 12:00
an API-created gist
Some lovely code, how nice!
@lornajane
lornajane / gist:4131314
Created November 22, 2012 14:01
localhost index
<?php
// phpinfo();
echo "verb: " . $_SERVER['REQUEST_METHOD'] . "\n";
echo "headers:";
var_dump(apache_request_headers());
echo "\n";
@lornajane
lornajane / text.txt
Created December 20, 2012 15:37
Gist created by API
Some riveting text
@lornajane
lornajane / poem.txt
Created May 2, 2013 11:00
Rather Lame Poetry
If I had the time, I'd make a rhyme
@lornajane
lornajane / get.php
Created May 2, 2013 13:53
Get a list of my gists with PHP streams
<?php
ini_set('user_agent', "PHP"); // github requires this
$api = 'https://api.github.com';
$url = $api . '/users/lornajane/gists';
// make the request
$response = file_get_contents($url);
// check we got something back before decoding
@lornajane
lornajane / benchmarks
Last active December 18, 2015 01:38
PHP benchmarks and version adoption, May 2013
Average time to run bench.php on my laptop, by PHP version
• 5.2.17: 3.77 seconds
• 5.3.23: 2.63 seconds
• 5.4.15: 1.98 seconds
• 5.5RC1: 2.11 seconds
function makeImgTag($src) {
return "<img src=\"" . $src . "\" />";
}