Skip to content

Instantly share code, notes, and snippets.

@dambridge
dambridge / UuidModel.php
Created September 8, 2016 23:52 — forked from danb-humaan/UuidModel.php
Trait for implementing UUIDs in Laravel models
<?php
namespace App\Traits;
use Rhumsaa\Uuid\Uuid;
use Illuminate\Database\Eloquent\ModelNotFoundException;
/**
* Trait UuidModel
* @package App\Traits
@dambridge
dambridge / laravel-blog-rss-read.php
Created September 7, 2016 20:49 — forked from james2doyle/laravel-blog-rss-read.php
Simple Guzzle pattern for reading a RSS Feed. This assumes you are using Laravel or something similar.
<?php
// use GuzzleHttp\Client;
// use Cache;
// 86400 = 1 day // 604800 = 1 week
$feed = Cache::remember('rr-blog', 86400, function()
{
$client = new Client([
'base_uri' => 'https://blog.raceroster.com/',
@dambridge
dambridge / Sorting.php
Created November 16, 2015 20:21 — forked from xwlee/Sorting.php
<?php
//////////////////////////////////
// Reddit "hot" story algorithm //
//////////////////////////////////
function hot($ups, $downs, $date)
{
if (is_string($date)) $date = strtotime($date);
$s = $ups - $downs;