Skip to content

Instantly share code, notes, and snippets.

@sam-higton
sam-higton / AggregateService.rb
Last active February 3, 2020 10:36
Aggregate service prototype
module AggregateService
def self.aggregate(collection, &block)
agg = Aggregate.new(collection, &block)
agg
end
module AggregateStages
def match(&block)
@stages << {
'$match' => Match.new(&block).formatted
@sam-higton
sam-higton / docker-compose.yml
Last active December 5, 2019 16:09
Docker Compose for simple zabbix setup. I don't know much about docker or zabbix, so proceed with caution.
version: '2'
services:
zabbix_db:
image: mysql/mysql-server:latest
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: supersecure
@sam-higton
sam-higton / Settings.php
Created November 12, 2015 10:29
A trait to handle user setting arrays in your classes
<?php
namespace MyProject\Behaviours;
trait Settings {
protected $settings;
public function loadSettings (array $settingsArray = array()) {
$this->settings = $settingsArray;
}
@sam-higton
sam-higton / BetterDateTime.php
Created October 16, 2015 22:25
You can now localize DateTime::format()
<?php
class BetterDateTime extends DateTime {
private $dictFormatToStrf = array (
"d" => "%d",
"D" => "%a",
"j" => "_nt-dm_", //%e
"l" => "%A",
"N" => "%u",
"S" => "_suffix_",