Skip to content

Instantly share code, notes, and snippets.

View philip's full-sized avatar

Philip Olson philip

  • Portland, OR
View GitHub Profile
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"license": {
"name": "MIT"
}
},
"host": "petstore.swagger.io",
@philip
philip / test-manifest-dates.php
Created June 21, 2016 20:33
Test installer manifest dates, report dates and releases since last mod date
<?php
$url = "http://cdn.mysql.com/windows/installer/manifest.zip";
$headers = get_headers($url, true);
if ($headers && false !== strpos($headers[0], '200') && !empty($headers['Last-Modified'])) {
$lastmod = new \DateTime($headers['Last-Modified']);
$today = new \DateTime;
$daysold = $lastmod->diff($today)->days;
$s = ($daysold === 1) ? 's' : '';
@philip
philip / add-workbench-home-link.php
Created January 14, 2015 19:44
This adds a link to the MySQL Workbench home screen.
@philip
philip / copy-mysql-tables.php
Last active August 29, 2015 14:12
Copies a MySQL table a bunch of times, for testing
<?php
/*
* Copy a MySQL table n times as foo1, foo2, foo3, etc.
* TODO: add proper error handing, and docs
*/
$params = array(
'host' => '127.0.0.1',
'port' => 3306,
'socket' => '',
@philip
philip / gist:4447352
Created January 3, 2013 21:16
Hack to test --enable-* and --with-* for PHP. This may or may not work, but seems to work. Proof-of-concept. :)
<?php
// TODO: Pass in --disable-all?
// Ideally, pass in all, and disable one at a time (know which caused failure), then log error, remove, try again
$enables = get_all_options('enable');
$withs = get_all_options('with');
$good = $bad = array();
foreach ($withs as $directive) {

Intention

This is a public gist with the intention of folks adding a few choice tidbits of goodness that they have stumbled over when using the SPL (Standard PHP Library).

The (not so) secret motivation here is to get some nice examples to go in the PHP documentation. :-)

Rules

@philip
philip / gist:93425
Created April 11, 2009 02:31
updating php.net info
One method for having a git repository recognize php.net cvs commits
as Github users is to change the author information. In this case,
add the php.net user information by running the following:
#!/bin/sh
git filter-branch --env-filter '
cn="$GIT_AUTHOR_NAME"
cm="$GIT_AUTHOR_NAME@php.net"
<function name="name">
<version></version>
<description></description>
<params>
<param type="" required="true">$paramName</param>
<param type="" required="false">$paramName</param>
</params>
<return></return>
<manual-url></manual-url>
</function>