Skip to content

Instantly share code, notes, and snippets.

View salathe's full-sized avatar
🐮
🔥

Peter Cowburn salathe

🐮
🔥
  • Akamai Technologies
  • Edinburgh, Scotland
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/static/js/analytics.js"></script>
<script type="text/javascript">archive_analytics.values.server_name="wwwb-app14.us.archive.org";archive_analytics.values.server_ms=158;</script>
<link type="text/css" rel="stylesheet" href="/static/css/banner-styles.css"/>
@salathe
salathe / results.txt
Created January 24, 2012 20:55
PHP array/string functions haystack/needle ordering
Array functions:
array_search $needle, $haystack
in_array $needle, $haystack
String functions:
strchr $haystack, $needle
stripos $haystack, $needle
stristr $haystack, $needle
strpos $haystack, $needle
strrchr $haystack, $needle
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>gettimeofday</methodname>
<methodparam choice="opt"><type>bool</type><parameter>return_float</parameter><initializer>false</initializer></methodparam>
</methodsynopsis>
<?php
$apiBase = 'http://api.microsofttranslator.com/V2/Http.svc';
$appId = 'yourappid';
$text = 'Een hoge boom vangt veel wind';
$streamContext = stream_context_create(array('http' => array(
'method' => 'POST',
'content' => '',
'header' => implode("\r\n", array('Content-Type: text/xml', 'Content-Length: 0')),
@salathe
salathe / gist:8317870
Last active January 2, 2016 14:39 — forked from J7mbo/gist:8317804
/**
* {@inheritdoc}
*
* @note Image dimensions returned as array(width, height)
*/
public function fetchMetaDataFrom($filePath)
{
if (!file_exists($filePath))
throw new MetaDataFileNotFoundException(sprintf("File %s could not be found for metadata retrieval", $filePath));
<?php
function ☃() { var_dump(__FUNCTION__); }
☃();
@salathe
salathe / nginx.conf
Created October 21, 2013 16:20 — forked from vessi/nginx.conf
# available in /etc/nginx/nginx.conf
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
root@php1box:/tmp/php# ./phpf.cgi
Content-type: text/html
<html><head><title>PHPF Usage</title></head><body>
<center><h1>PHPF Usage</h1></center>
Call <i>phpf.cgi</i> with a url like <tt>http://host@domain/~user/phpf.cgi?arg</tt> where arg is one of:<br>
<pre> <tt>form+dest_url</tt></pre>
</body></html>
<?php
namespace Seedstream;
use React\EventLoop\LoopInterface,
React\Socket\ConnectionInterface;
class Pusher
{
private $loop;