Skip to content

Instantly share code, notes, and snippets.

@s-ludwig
s-ludwig / taggedalgebraic.d
Last active August 2, 2016 18:47
Algebraic data type based on a tagged union
// https://github.com/s-ludwig/taggedalgebraic
@s-ludwig
s-ludwig / dietbench.d
Last active August 29, 2015 14:20
Diet compile time benchmark
module dietbench;
import core.vararg;
import std.algorithm;
import std.ascii : isAlpha;
import std.array;
import std.conv;
import std.format;
import std.range;
import std.string;
@s-ludwig
s-ludwig / redis_stripped.d
Last active August 2, 2016 18:48
Helper template to strip a struct of any fields not storable in a `RedisObjectCollection`
// http://vibed.org/api/vibe.db.redis.idioms/RedisStripped
@s-ludwig
s-ludwig / gist:c61ec308e41ab8e8a3ce
Last active August 2, 2016 18:49
TaggedAlgebraic
// https://github.com/s-ludwig/taggedalgebraic
@s-ludwig
s-ludwig / sdlserializer.d
Last active August 29, 2015 14:05
vibe.data.serialization module for sdlang-d
sdlang.Tag serializeSDL(T)(T value)
{
import vibe.data.serialization;
return serialize!SDLSerializer(value);
}
T deserializeSDL(T)(sdlang.Tag root)
{
return deserialize!(SDLSerializer, T)(root);
}
@s-ludwig
s-ludwig / pipedprocess.d
Created January 15, 2014 10:54
Vibe.d compatible process wrapper class.
class PipedProcess {
import stdfilestream;
private {
ProcessPipes m_pipes;
StdFileStream m_stdout;
StdFileStream m_stdin;
Thread m_waitThread;
SysTime m_startTime;
SysTime m_endTime;
@s-ludwig
s-ludwig / app-package.json
Created December 11, 2013 18:44
Workaround for linking to a DUB dependency instead of compiling it together with the application source code.
{
"name": "myapp",
"dependencies": {
"mylib": "~master"
},
"subConfigurations": {
"mylib": "import"
}
}
@s-ludwig
s-ludwig / stdfilestream.d
Last active August 2, 2016 18:46
Wrapper class to make an existing `File` stream usable in a vibe.d event loop.
// NOTE: This class is now part of vibe.d, see http://vibed.org/api/vibe.stream.stdio/StdFileStream