Skip to content

Instantly share code, notes, and snippets.

View alexbilbie's full-sized avatar
👋

Alex Bilbie alexbilbie

👋
View GitHub Profile
@alexbilbie
alexbilbie / gist:1506589
Last active September 28, 2015 22:38
Recurring events with cron-like syntax
<?php
date_default_timezone_set('Europe/London');
function dd()
{
die(var_dump(func_get_args()));
}
function dp($i)
{
@alexbilbie
alexbilbie / gist:1588897
Created January 10, 2012 12:48
Access token grab
<?php
function signin()
{
if ($code = $_GET['code'])
{
$params = array(
'client_id' => $this->client_id,
'client_secret' => $this->client_secret,
'redirect_uri' => $this->redirect_uri,
'grant_type' => 'authorization_code',
@alexbilbie
alexbilbie / gist:1846082
Created February 16, 2012 16:06
Code is Poetry
@alexbilbie
failed to write a haiku
no new badge for him
@alexbilbie
alexbilbie / PSR-0-final-proposal.md
Created April 8, 2012 22:11 — forked from Thinkscape/PSR-0-final-proposal.md
PSR-0 Final Proposal (PHP Standards Working Group)

PSR-0 Final Proposal (PHP Standards Working Group)

The following describes the mandatory requirements that must be adhered to for autoloader interoperability.

Mandatory:

  • A fully-qualified namespace and class must have the following structure \ <Vendor Name> \ (<Namespace>)* \ <Class Name>
  • Each namespace must have a top-level namespace ("Vendor Name").
  • Each namespace can have as many sub-namespaces as it wishes.
  • Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system.
  • Each "_" character in the CLASS NAME is converted to a DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace.
@alexbilbie
alexbilbie / gist:2475211
Created April 24, 2012 01:04
University of Lincoln SPARQL queries

University of Lincoln SPARQL Queries

Organisation

Get all divisions

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX org: <http://www.w3.org/ns/org#>
@alexbilbie
alexbilbie / gist:2763832
Created May 21, 2012 18:37
Sublime 2 CodeSniffer plugin
{
// Plugin settings
// Turn the debug output on/off
"show_debug": false,
// Which file types (file extensions), do you want the plugin to
// execute for
"extensions_to_execute": ["php"],
<?php
$context = stream_context_create(array('http' => array('timeout' => 10)));
try
{
$eprints_response = file_get_contents('URL HERE', FALSE, $context);
}
catch (Exception $e)
@alexbilbie
alexbilbie / gist:3104893
Created July 13, 2012 13:30
Byword broken code parser
* test list
* test list
* test list
code block which won't work
foo bar foo bar foo bar foo
* test list
* test list
* test list
@alexbilbie
alexbilbie / gist:3169400
Created July 24, 2012 11:02
Food you should always have in

Basics

  • Tin/carton chopped tomatoes
  • Tube of tomato puree
  • White onions
  • Red onions
  • Garlic
  • New potatoes
  • Easy cook rice
  • Risotto rice
@alexbilbie
alexbilbie / gist:3193757
Created July 28, 2012 15:34
PHP Hubot script
#!/usr/bin/php
<?php
$vars = explode(' ', $argv[1]);
if ($vars[0] === 'hello')
{
echo 'Hello, ' . $vars[1] . '. How are you?' . PHP_EOL;
}