Skip to content

Instantly share code, notes, and snippets.

@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 / post.php
Created May 2, 2013 13:55
create a gist using PHP and streams
<?php
include "github-creds.php"; // sets $access_token
ini_set('user_agent', "PHP"); // github requires this
$api = 'https://api.github.com';
$url = $api . '/gists'; // no user info because we're sending auth
// prepare the body data
$data = json_encode(array(
@lornajane
lornajane / patch.php
Created May 2, 2013 13:57
update the gist we made via the GitHub API, using PHP and streams
<?php
include "github-creds.php"; // sets $access_token
ini_set('user_agent', "PHP"); // github requires this
$api = 'https://api.github.com';
$url = $api . '/gists/5501496'; // URL of the specific gist
// prepare the body data
$data = json_encode(array(
@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 . "\" />";
}
@lornajane
lornajane / Message.php
Created August 9, 2013 08:13
Toy Messages classes
<?php
class Message
{
public function __construct($msg, $user) {
$this->msg = $msg;
$this->user = $user;
$this->created = new DateTime();
}
@lornajane
lornajane / gist:dc2b38443e5e1dbb5ab8
Created July 8, 2015 20:40
Android compile error
$ gradle build
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android-app'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find com.android.support:appcompat-v7:22.2.0.
Searched in the following locations:
@lornajane
lornajane / text.txt
Created July 23, 2015 18:29
Gist created by API
Some riveting text
@lornajane
lornajane / text.txt
Created July 23, 2015 18:30
Gist created by API
Some riveting text