Skip to content

Instantly share code, notes, and snippets.

View h2ero's full-sized avatar

h2ero

  • Beijing,China
View GitHub Profile
@h2ero
h2ero / pre-receive
Last active February 21, 2017 05:06 — forked from proofek/pre-receive
pre-receive git hook to run php linter
#!/usr/bin/php
<?php
echo "\nRunning php linter...\n";
$params = explode(' ', file_get_contents('php://stdin'));
$ref = trim($params[1]);
$diff = array();
$return = 0;
@h2ero
h2ero / gist:ccf90f3592b06d9510655902b274b61d
Created May 28, 2016 04:16 — forked from codler/gist:3906826
Support HTTP Header Range, mp4, php.php/mp4.mp4
<?php
# Nginx don't have PATH_INFO
if (!isset($_SERVER['PATH_INFO'])) {
$_SERVER['PATH_INFO'] = substr($_SERVER["ORIG_SCRIPT_FILENAME"], strlen($_SERVER["SCRIPT_FILENAME"]));
}
$request = substr($_SERVER['PATH_INFO'], 1);
$file = $request;
$fp = @fopen($file, 'rb');
@h2ero
h2ero / UUID.php
Created November 4, 2013 04:59 — forked from dahnielson/UUID.php
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4211 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
<?php
interface Worker
{
public function getCommand();
public function done($stdout, $stderr);
public function fail($stdout, $stderr, $status);
}