Skip to content

Instantly share code, notes, and snippets.

View run-dlang's full-sized avatar

Eleanor Cross run-dlang

View GitHub Profile
@run-dlang
run-dlang / main.d
Created April 5, 2018 13:42
Code shared from run.dlang.io.
import std.concurrency : receiveOnly, send,
spawn, Tid, thisTid;
import core.atomic : atomicOp, atomicLoad;
import core.sync.mutex;
shared Mutex mtx;
/*
Queue that can be used safely among
@run-dlang
run-dlang / main.d
Created April 5, 2018 13:51
Code shared from run.dlang.io.
import std.concurrency : receiveOnly, send,
spawn, Tid, thisTid;
import core.atomic : atomicOp, atomicLoad;
import core.sync.mutex;
shared Mutex mtx;
/*
Queue that can be used safely among
@run-dlang
run-dlang / main.d
Created April 5, 2018 14:47
Code shared from run.dlang.io.
import std.stdio;
void main()
{
ivec4 v = ivec4([0, 1, 2, 3]);
writeln(v);
writeln(v.xyzw);
writeln(v.w);
writeln(v.stpq);
writeln(v.rgba);
v.xy = ivec2([7,8]);
@run-dlang
run-dlang / main.d
Created April 5, 2018 15:08
Code shared from run.dlang.io.
import std.stdio;
void main()
{
ivec4 v = ivec4([0, 1, 2, 3]);
writeln(v);
writeln(v.xyzw);
writeln(v.w);
writeln(v.stpq);
writeln(v.rgba);
v.xy = ivec2([7,8]);
@run-dlang
run-dlang / main.d
Created April 5, 2018 17:16
Code shared from run.dlang.io.
void main()
{
import std.stdio;
(vec2(1,5)-ivec2(9,9)).writeln;
}
struct Vector(T, int N)
{
import std.traits : CommonType, isNumeric;
T[N] data;
@run-dlang
run-dlang / main.d
Created April 5, 2018 17:31
Code shared from run.dlang.io.
import std.stdio;
void main()
{
string list = "3, 5, 1, , not a number, 100";
import std.algorithm;
import std.string;
import std.conv;
import std.range : array;
@run-dlang
run-dlang / main.d
Created April 5, 2018 17:47
Code shared from run.dlang.io.
import std.stdio;
void main()
{
writeln("Hello D");
}
@run-dlang
run-dlang / main.d
Created April 7, 2018 03:10
Code shared from run.dlang.io.
import std.stdio;
void main() {
writeln("Hello D");
}
@run-dlang
run-dlang / main.d
Created April 7, 2018 03:14
Code shared from run.dlang.io.
import std.stdio;
void main() {
writeln("Hello There!");
}
@run-dlang
run-dlang / main.d
Created April 7, 2018 03:17
Code shared from run.dlang.io.
import std.stdio;
void main()
{
string list = "3, 5, 1, , not a number, 100";
import std.algorithm;
import std.string;
import std.conv;
import std.range : array;