Skip to content

Instantly share code, notes, and snippets.

View fermino's full-sized avatar

Fermín Olaiz fermino

View GitHub Profile
@nostah
nostah / gist:d610459d50564c729c56
Created April 13, 2015 07:42
php swagger 2.0 api sample
<?php
use Swagger\Annotations as SWG;
/**
* @SWG\Swagger(
* basePath="/v1",
* host="api.local",
* schemes={"http"},
* produces={"application/json"},
@milo
milo / github-webhook-handler.php
Last active July 26, 2023 15:29
GitHub Webhook Handler
<?php
/**
* GitHub webhook handler template.
*
* @see https://docs.github.com/webhooks/
* @author Miloslav Hůla (https://github.com/milo)
*/
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check
@robot56
robot56 / gist:8499806
Created January 19, 2014 02:45
PCI information, sorted by Vendor IDs.
This file has been truncated, but you can view the full file.
{
"0x0033": {
"0x002F": {
"Vendor Name": "Paradyne Corp.",
"Device Name": "ieee 1394 controller"
},
"0x00333": {
"Vendor Name": "Paradyne Corp.",
"Device Name": "1ACPI\\GenuineIntel_-_x86_Family_6_Model_23\\_0"
}
@Nilpo
Nilpo / Session.php
Last active August 5, 2023 16:48
A simple session wrapper class to provide static OOP access to PHP sessions.
<?php
/**
* Session Helper Class
*
* A simple session wrapper class.
*
* Recommended for use with PHP 5.4.0 or higher. (Not required.)
*
* Usage Example:
@extraordinaire
extraordinaire / reconnecting_pdo.php
Last active June 27, 2023 11:12
Reconnectable PDO
<?php
class ReconnectingPDO
{
protected $dsn, $username, $password, $pdo, $driver_options;
public function __construct($dsn, $username = "", $password = "", $driver_options = array())
{
$this->dsn = $dsn;
$this->username = $username;
$this->password = $password;
@akDeveloper
akDeveloper / class_constants.php
Created November 13, 2012 13:09
PHP override class constants
<?php
class Foo
{
const TEST = 'foo';
public static function getConst()
{
return static::TEST;
}
/* fix_fft.c - Fixed-point in-place Fast Fourier Transform */
/*
All data are fixed-point short integers, in which -32768
to +32768 represent -1.0 to +1.0 respectively. Integer
arithmetic is used for speed, instead of the more natural
floating-point.
For the forward FFT (time -> freq), fixed scaling is
performed to prevent arithmetic overflow, and to map a 0dB
sine/cosine wave (i.e. amplitude = 32767) to two -6dB freq
@ircmaxell
ircmaxell / Expressions.php
Created September 21, 2011 16:51
A math parser and evaluator implementation
<?php
class Parenthesis extends TerminalExpression {
protected $precidence = 6;
public function operate(Stack $stack) {
}
public function getPrecidence() {
return $this->precidence;