Skip to content

Instantly share code, notes, and snippets.

use pgehres;
RENAME TABLE squidlog TO files;
ALTER TABLE files
ADD COLUMN directory VARCHAR(256) NOT NULL,
ADD COLUMN sample_rate INT(2) UNSIGNED DEFAULT NULL,
ADD COLUMN status ENUM('processing', 'consumed') NOT NULL,
ADD COLUMN consumed_events INT UNSIGNED DEFAULT NULL,
ADD COLUMN ignored_events INT UNSIGNED DEFAULT NULL,
ADD COLUMN invalid_events INT UNSIGNED DEFAULT NULL,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var data1 = { prop: "hi" };
var data2 = data1;
data2 = {};
console.log ( data1 );
@AndrewGreen
AndrewGreen / TypesafeEnum.php
Last active August 29, 2015 13:57
Another PHP typesafe enum idea
<?php
/**
* To create some typesafe enums, just extend this class, declare and initialize
* to null a protected static property called $values, and implement getNames()
* to return an array with the enums you want. Then you can access your
* enums with YourClassName::ENUM_NAME(). Also, your subclass should be final.
*
* Disadvantages:
* - Usage is ugly.
@AndrewGreen
AndrewGreen / TypesafeEnum.php
Last active August 29, 2015 13:57
Idea for PHP typesafe enum
<?php
/**
* To create some typesafe enums, just extend this class, declare some static
* properties, then call YourClassName::setUp(). Example follows.
*
* Disadvantages:
* - Since the enums are public properties, they could be modified by
* mistake (or intentionally by malicious code).
* - YourClassName::setUp() must be called.