Skip to content

Instantly share code, notes, and snippets.

View pedroborges's full-sized avatar
🏠
Working from home

Pedro Borges pedroborges

🏠
Working from home
View GitHub Profile
/* Generate unique values with the UUID() function. */
UPDATE table SET column = UUID();
/* Optionally strip the hyphens from the values. */
UPDATE table SET column = REPLACE(UUID(), '-', '');
@pedroborges
pedroborges / enum.php
Created February 3, 2014 12:42
An alternative to ENUM in DB.
// Taken from: https://laracasts.com/forum/88-how-do-you-handle-enums
class OrderStatus implements Enum
{
const FRAUD = -2;
const CANCELLED = -1;
const UNPAID = 0;
const RECEIVED = 1;
const PARTIALLY_SHIPPED = 10;
const SHIPPED = 20;
@pedroborges
pedroborges / config.hdf
Created February 1, 2014 19:12
HHVM config.hdf for Laravel
Server {
Port = 80
SourceRoot = /var/www/public/
}
VirtualHost {
* {
Pattern = .*
RewriteRules {
* {
@pedroborges
pedroborges / rm-docker-images.sh
Created January 28, 2014 16:58
Removes all Docker containers then all its images.
#!/bin/bash
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -a -q)