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 lines; | |
import std.file; | |
import std.path; | |
import std.stdio; | |
import std.regex; | |
import std.getopt; | |
import std.string; | |
import std.traits; | |
import std.algorithm; |
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
public struct NotNull<T> where T : class | |
{ | |
private T mValue; | |
public T Value | |
{ | |
get { return this.mValue; } | |
set | |
{ | |
if( value == null ) | |
throw new ArgumentNullException( "value" ); |
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 envy; | |
version( Windows ): | |
private { | |
import std.windows.registry; | |
} | |
private enum ENV_KEY = "Environment"; |
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 annotations; | |
private { | |
import std.string; | |
import std.traits; | |
import std.array; | |
} | |
private template TargetInfo( alias target ) | |
{ |
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
//Compile with: csc /nologo /r:System.Drawing.dll imgconv.cs | |
using System; | |
using System.IO; | |
using System.Drawing; | |
using System.Reflection; | |
using System.Drawing.Imaging; | |
static class Program | |
{ |
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
/+ | |
Compile with: | |
dmd pack.d | |
Options: | |
Flag Type Required Default Description | |
--------------------------------------------------------- | |
--out string yes <none> The name of the .ui file to output. | |
--dir string yes <none> The source directory to pack. | |
--width uint yes <none> Window client size width. |
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 util; | |
bool contains( T )( T[] a, T item ) | |
{ | |
foreach( x; a ) | |
if( x == item ) | |
return true; | |
return false; | |
} |
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 eventhandler; | |
/+ | |
EventHandler implementation. | |
+/ | |
struct EventHandler( TArgs... ) | |
{ | |
private import std.algorithm; | |
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
#Call with `python.exe bomb_size.py --noc` | |
#to suppress the thousands separator. | |
from sys import argv | |
suppressComma = len( argv ) >= 2 and argv[1] == "--noc" | |
def humanSize( size, places = 2, lower = False ): | |
units = ( "B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" ) | |
index = 0 | |
newSize = size |
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
using System; | |
public static class Format | |
{ | |
public static string HumanSize( int size, int places = 2, bool lower = false ) | |
{ | |
return Format.HumanSize( Convert.ToDecimal( size ), places, lower ); | |
} | |
public static string HumanSize( long size, int places = 2, bool lower = false ) |