Skip to content

Instantly share code, notes, and snippets.

View auroraeosrose's full-sized avatar

Elizabeth M Smith auroraeosrose

View GitHub Profile
@auroraeosrose
auroraeosrose / gist:3285787
Created August 7, 2012 14:25
How to use an alpha channel image on a gtk window to do a pixmap
/**
* public function set_image
*
* sets a background image for the splash screen
*
* @param string $image absolute path to splash background
* @return void
*/
public function set_image($image)
{
<?php
use Eos\Datastructures\Immutable;
use Eos\Datastructures\Struct;
class Rectangle extends Struct implements Immutable {
public $x;
public $y;
public $height;
public $width;
}
@auroraeosrose
auroraeosrose / gist:3388410
Created August 18, 2012 17:03
Enum Wrapper class - what do YOU think it outputs ;)
use G\Enum as Enum;
<?php
class Fruit extends Enum {
const Apple = 1;
const Pear = 2;
const Banana = 3;
}
$fruit = new Fruit(Fruit::Apple);
@auroraeosrose
auroraeosrose / http_parse_query
Created November 14, 2012 19:55
http_parse_query is parse_str with non-stupid api (and fits http_build_query better as well)
/* {{{ proto array http_parse_query(string encoded_string)
parses query string into array */
PHP_FUNCTION(http_parse_query)
{
char *arg;
int arglen;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) {
return;
}
@auroraeosrose
auroraeosrose / gist:4079381
Created November 15, 2012 16:00
Run tests.php from 5.5 alpha fixed for spaces in executable path
#!/usr/bin/env php
<?php
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@auroraeosrose
auroraeosrose / common.inc
Created November 15, 2012 17:54
Fix for issues in windows_acls tests - changes . to __DIR__ in fix_acls call
<?php
error_reporting(E_ALL);
define('PHPT_ACL_READ', 1 << 1);
define('PHPT_ACL_WRITE', 1 << 2);
define('PHPT_ACL_EXEC', 1 << 3);
define('PHPT_ACL_NONE', 1 << 4);
define('PHPT_ACL_FULL', 1 << 5);
define('PHPT_ACL_GRANT', 1);
define('PHPT_ACL_DENY', 2);
@auroraeosrose
auroraeosrose / php_cli_server.inc
Created November 15, 2012 18:13
Spaces happen folks - a lot
<?php
define ("PHP_CLI_SERVER_HOSTNAME", "localhost");
define ("PHP_CLI_SERVER_PORT", 8964);
define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) {
$php_executable = getenv('TEST_PHP_EXECUTABLE');
$doc_root = __DIR__;
$router = "index.php";
@auroraeosrose
auroraeosrose / InitialIdeas.md
Created June 19, 2014 23:22
Ideas for merged extension generator

An initial dump of ideas for a php generator

  1. use composer and symfony console tools for cli manipulation
  2. pluggable architecture

components needed - configuration parsing scanning? (helper for generating definitions) templating

@auroraeosrose
auroraeosrose / a
Created February 22, 2013 19:16
How to do arrayobject with multidimensional fun
<?php
$obj1 = new ArrayObject([new ArrayObject([1,2,3]), 1]);
unset($obj1[0][0]);
<?php
$url = 'https://verifier.login.persona.org/verify';
$data = 'assertion='.$_POST['assertion'].'&audience=http://persona.localhost:80';
$params = array('http' => array(
'method' => 'POST',
'content' => $data
),
'ssl' => array('verify_peer' => true
'verify_host' => true));