Skip to content

Instantly share code, notes, and snippets.

View bhelyer's full-sized avatar

Bernard Helyer bhelyer

  • Auckland, New Zealand
View GitHub Profile
#include <stdio.h>
#include <wchar.h>
int main(void)
{
printf("%d\n", sizeof(wchar_t));
return 0;
}
[~]$ ed test.d
test.d: No such file or directory
i
import std.stdio;
void main()
{
string ☪ = "☺";
writeln(☪);
}
diff -r f7d31065be69 d/dmd2/aggregate.h
--- a/d/dmd2/aggregate.h Sat Jan 16 16:24:03 2010 -0500
+++ b/d/dmd2/aggregate.h Fri Feb 05 10:44:37 2010 +1300
@@ -127,7 +127,7 @@
void semantic(Scope *sc);
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
char *mangle();
- char *kind();
+ const char *kind();
int needOpAssign();
import std.stdio;
void main()
{
foreach (line; cast(string) stdin.byLine) {}
}
new st((void delegate(SomePropType, OtherPropType) yield)
{
foreach (c; SomeCollection) {
if (c.SomeProperty >= someValue * 2) continue;
yield(c.SomeProperty, c.OtherProperty);
}
});
@bhelyer
bhelyer / st.d
Created February 11, 2010 22:43
new st((void delegate(SomePropType, OtherPropType) yield)
{
foreach (c; SomeCollection) {
if (c.SomeProperty >= someValue * 2) continue;
yield(c.SomeProperty, c.OtherProperty);
}
});
module dls.model.citytree;
import dls.util.rect;
enum Quad
{
NE,
NW,
SW,
module dsext;
/*
Let's try adding a new object type to DMDScript.
I shall call my new object... Monkey!
It shall have a property called "furColor"
with the value "brown".
It shall have a property called "hungry"
with the value 'true'.
It shall also have a method called "eatBanana"
int global;
void main()
{
int i = 0;
int j = 5;
int k = i + j;
k = k * 2;
return k;
import std.stdio;
import std.date;
void main()
{
auto localtime = UTCtoLocalTime(getUTCtime());
writeln("The current time is " ~ std.date.toString(localtime));