This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple binary serialisation of value types (oh, and arrays and AAs). | |
* | |
* Copyright © 2007 Daniel Keep | |
* License: http://www.opensource.org/licenses/zlib-license.php | |
*/ | |
module serial; | |
version(Serial_NoReals) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts a function pointer to a delegate pointer. | |
* | |
* Copyright: © 2009, Daniel Keep. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright: © 2009, Daniel Keep. | |
* License: MIT <http://www.opensource.org/licenses/mit-license.php> | |
*/ | |
module etc.mem.util; | |
private | |
struct Align | |
{ | |
ubyte a; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Demonstration of a library-level Property implementation. | |
*/ | |
import std.stdio; | |
const DefaultGetter = ""; | |
const DefaultSetter = DefaultGetter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Contains functions that operate on functions and delegates. | |
* | |
* Copyright: Copyright © 2009, Daniel Keep. | |
* License: BSD v2 <http://www.opensource.org/licenses/bsd-license.php> | |
* Authors: Daniel Keep | |
*/ | |
module tangox.util.Func; | |
import tango.core.Traits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Parses the storage class for function arguments. | |
/// Authors: Daniel Keep | |
/// Copyright: Copyright © 2009 Daniel Keep | |
/// License: BSD v2 <http://www.opensource.org/licenses/bsd-license.php> | |
module argparse; | |
enum ParamSemantics | |
{ | |
None = 0b0000, | |
In = 0b0001, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Collatz graph generator (inspired by http://www.xkcd.com/710/) | |
* Written by Daniel Keep; released to the Public Domain. | |
* | |
* To use this, compile and either dump the output to a file, or feed it | |
* directly into GraphViz like so: | |
* | |
* ----- | |
* collatz 100 | dot -Ocollatz_100.svg -Tsvg | |
* ----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
That's 'binary search', not 'cow excrement' I'll have you know... | |
Written for http://reprog.wordpress.com/2010/04/19/are-you-one-of-the-10-percent/ | |
Sadly, there IS a bug in the original, unmodified version of the search due | |
entirely to me trying to be clever. | |
To compile and run this (using dmd), use: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module reprog_ssort; | |
/** | |
* Selection sort. | |
* | |
* This time actually writing out the various invariants and conditions. | |
* We're being FORMAL now, bitches. | |
* | |
* Compile with the 'paranoid' debug identifier to turn on all the various | |
* checks. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
Function to compute DPI from diagonal screen length | |
and pixel dimensions. | |
Written in MathEval: http://github.com/DanielKeep/MathEval | |
" | |
let dpi(phD, pxW, pxH) = pxW / (phD / sqrt((pxH/pxW)**2 + 1)) |
OlderNewer