Skip to content

Instantly share code, notes, and snippets.

View dznz's full-sized avatar

Daniel Zollinger dznz

  • free agent
  • Auckland, New Zealand
  • X @dznz
View GitHub Profile
@dznz
dznz / gist:4e1bcb3068469297cc32
Created December 4, 2014 23:26
Extracting Workflows with DCI - Link Dump
@dznz
dznz / gist:e890a35259271f89a118
Created May 5, 2015 22:36
Using array operations to simplify conditional complexity
def build_date_filter(earliest_date, latest_date)
return '' if !earliest_date && !latest_date
latest_date_query = "publicationDate > #{earliest_date}" if earliest_date
earliest_date_query = "publicationDate < #{latest_date}" if latest_date
if latest_date_query && earliest_date_query
"(#{latest_date_query} AND #{earliest_date_query})"
else
latest_date_query ? latest_date_query : earliest_date_query
end
end
@dznz
dznz / simple_decorator.rb
Created October 27, 2015 03:33
Simple decorator example
require 'delegate'
class SimpleDecorator < SimpleDelegator
attr_reader :context
def initialize(raw, view_context = nil)
@context = view_context if view_context
super raw
end
@dznz
dznz / gist:64a34466f44d1a335e75
Created October 29, 2015 22:40
Extract the filename from a path in Excel or Google spreadsheet
=TRIM(RIGHT(SUBSTITUTE(A1,"/",REPT(" ",100)),99))
@dznz
dznz / gist:daab53a4343d4b00c3d361a798201564
Created July 7, 2016 05:31
From the codewars functional list kata - an immutable linked list with efficient operations.
function List() {}
function EmptyList() {}
EmptyList.prototype = new List();
EmptyList.prototype.constructor = EmptyList;
EmptyList.prototype.toString = function() { return "()"; };
EmptyList.prototype.isEmpty = function() { return true; };
EmptyList.prototype.length = function() { console.log('length 0'); return 0; };
EmptyList.prototype.push = function(x) { return new ListNode(x, this); };
@dznz
dznz / oti-openapi.yaml
Created January 31, 2019 23:53
DIA OTI Swagger definition draft
openapi: 3.0.0
info:
description: API Spec for OTI
termsOfService: /tos
title: OTI API
version: 0.0.1
components:
securitySchemes:
api_key:
type: http
@dznz
dznz / The_smollest_issue.md
Last active November 18, 2022 05:00
Incident report regarding smollestbunny @ mastodon.nz

My incident report regarding smollestbunny @ mastodon.nz

As I speak, mastodon.nz is up to 7.5k active accounts. That's bananas, crazy numbers, for a server that a few weeks ago had an order of magnitude fewer folks. I tender my heartfelt congratulations to the admins and moderators of the server; what a wild ride!

It does mean that mastodon.nz is now easily the single biggest host of the NZTwit community, and this confers hefty moderation responsibilities on a team that has expanded quickly to meet its needs. A volunteer team, mind you, motivated not by money or glory but by an interest in growing and supporting a community. Unpaid, and during their free time.

At the best of times, moderation isn't easy. Actually, mostly it sucks. Besides the day-to-day noise of defederating from openly fascistic servers, and dealing with the crappy flotsam that drifts in from the fediverse, there's the community itself. Everyone's always stepping on each others' toes, and often there's not a way to adjudicate i