Skip to content

Instantly share code, notes, and snippets.

@schveiguy
schveiguy / gbdateadded.d
Created July 12, 2020 13:57
Take a golf blitz team message and print out all the times the players joined.
import iopipe.bufpipe;
import iopipe.textpipe;
import iopipe.json.serialize;
import iopipe.json.parser;
import iopipe.json.dom;
import std.io;
import std.typecons;
import std.datetime;
import std.conv;
@schveiguy
schveiguy / day1.md
Last active September 28, 2020 00:29
Beerconf 2020 September

Major topics discussed during BeerConf September 2020 edition

  1. Walter implemented __totype(string) (dlang/dmd#11797) Points raised in objection to the feature are:
  • It can't work in CTFE, as they are not polymorphic
  • It's inferior to the capabilities type functions

(General conversation about science fiction books, genres, and authors)

  1. All rejoice for -preview=in!
@schveiguy
schveiguy / sqldemo.d
Last active June 7, 2021 15:17
Show sqlbuilder usage
import sqlbuilder.uda;
import sqlbuilder.dataset;
import sqlbuilder.dialect.sqlite;
// Note all of these are sql-injection-proof
struct users
{
@primaryKey @autoIncrement int id; // a non-unique primary key doesn't make sense
string name;
@schveiguy
schveiguy / d1ops.d
Last active June 14, 2022 16:30
D1 operator overloads
mixin template D1Ops() {
// binary operations
static foreach(op, d1;
["+" : "opAdd", "-" : "opSub", "*" : "opMul", "/" : "opDiv",
"%" : "opMod", "&" : "opAnd", "^" : "opXor", "|" : "opOr",
"<<" : "opShl", ">>" : "opShr", ">>>" : "opUShr", "~" : "opCat",
"in" : "opIn"]) {
static if(__traits(hasMember, typeof(this), d1))
alias opBinary(string s : op) = mixin(d1);
// _r version