This file contains hidden or 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
import std.stdio; | |
template loadFile(string filePath, string accessorName) { | |
const char[] loadFile = "@property string " ~ accessorName ~ "() { return \"" ~ import(filePath) ~ "\";}"; | |
} | |
mixin(loadFile!("hello.txt", "contentOfHelloDotTxt")); | |
void main() | |
{ | |
writeln(contentOfHelloDotTxt); |
This file contains hidden or 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
Error executing command build: Range violation | |
Full exception: [email protected](117): Range violation | |
---------------- | |
dub(_d_array_bounds+0x26) [0x6c9ba2] | |
dub() [0x62f9b1] | |
dub(_D3dub10generators9generator16ProjectGenerator7collectMFS3dub10generators9generator17GeneratorSettingsC3dub8package_7PackageKHAyaS3dub10generators9generator16ProjectGenerator10TargetInfoxHAyaAyaKAAyaZS3dub9compilers8compiler13BuildSettings14__foreachbody7MFKAyaKxS3dub10dependency10DependencyZi+0x423) [0x62de87] | |
dub(_aaApply2+0x6a) [0x6cb97a] | |
dub(dub.compilers.compiler.BuildSettings dub.generators.generator.ProjectGenerator.collect(dub.generators.generator.GeneratorSettings, dub.package_.Package, ref dub.generators.generator.ProjectGenerator.TargetInfo[immutable(char)[]], const(immutable(char)[][immutable(char)[]]), ref immutable(char)[][])+0x679) [0x62d90d] | |
dub(_D3dub10generators9generator16ProjectGenerator7collectMFS3dub10generators9generator17GeneratorSettingsC3dub8package_7PackageKHAyaS3dub10genera |
This file contains hidden or 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 string WebGetString(Uri endpoint, string path, params WebParam[] queryParams) | |
{ | |
System.Net.WebClient client = new System.Net.WebClient(); | |
StringBuilder relativePath = new StringBuilder(path); | |
var filteredParams = (from p in queryParams where p.Value != null select p).ToArray(); | |
if (filteredParams != null && filteredParams.Length > 0) | |
{ | |
relativePath.Append("?"); | |
foreach (var param in filteredParams) | |
{ |
This file contains hidden or 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
import std.stdio; | |
import mime; | |
void main() { | |
/*Proposal for Mime type package for D*/ | |
auto mime = Mime.fromExtension(".midi"); | |
assert(mime.description == "MIDI Audio"); | |
mime = Mime.fromType("application/x-midi"); | |
assert(mime.description == "MIDI Audio"); |
This file contains hidden or 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
500 - Internal Server Error | |
Internal Server Error | |
Internal error information: | |
core.exception.AssertError@../../../opt/vibe/source/vibe/core/drivers/libevent2_tcp.d(120): Trying to acquire a TCP connection that is currently owned. | |
---------------- | |
./dub-registry(_d_assert_msg+0x45) [0xa12b0d] | |
./dub-registry(void vibe.core.drivers.libevent2_tcp.Libevent2TCPConnection.acquire()+0xe3) [0x7a0b27] | |
./dub-registry(void vibe.core.drivers.libevent2_tcp.Libevent2TCPConnection.close()+0x6e) [0x7a0df2] |
This file contains hidden or 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
import std.stdio : writeln; | |
import std.json; | |
void main() { | |
JSONValue[] values = [parseJSON("28"), | |
parseJSON("\"hello world\""), | |
parseJSON(q{{"name": "Johan"}}), | |
parseJSON("[2,3]"), | |
parseJSON("true"), | |
parseJSON("false"), |
This file contains hidden or 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
/** | |
JSON type enumeration | |
*/ | |
enum JSON_TYPE : byte | |
{ | |
/// Indicates the type of a $(D JSONValue). | |
STRING, | |
INTEGER, /// ditto | |
UINTEGER,/// ditto | |
FLOAT, /// ditto |
This file contains hidden or 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
import std.json; | |
... | |
JSONValue doc; | |
assert(doc == JSONValue.init); // always true, doc was never assigned. |
This file contains hidden or 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
import heaploop.looping; | |
import couched; | |
import std.json; | |
void main() { | |
loop ^^ { | |
auto client = new CouchedClient("http://127.0.0.1:5984"); | |
client.databases.ensure("albums"); | |
CouchedDatabase db = client.databases["albums"]; |
This file contains hidden or 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
/* | |
* http://johan.heapsource.com | |
*/ | |
import std.stdio; | |
import std.json; | |
void main() { | |
JSONValue * v = new JSONValue; | |
*v = parseJSON(q{ |