Skip to content

Instantly share code, notes, and snippets.

@psihy
Last active December 14, 2015 01:08

Revisions

  1. psihy revised this gist Feb 21, 2013. 1 changed file with 63 additions and 63 deletions.
    126 changes: 63 additions & 63 deletions gistfile1.d
    Original file line number Diff line number Diff line change
    @@ -1,70 +1,70 @@
    import std.algorithm, std.array, std.stdio, std.typecons;

    immutable statusCode = [
    tuple("100", "Continue"),
    tuple("101", "Switching Protocols"),
    tuple("102", "Processing"),
    tuple("200", "OK"),
    tuple("201", "Created"),
    tuple("202", "Accepted"),
    tuple("203", "Non-Authoritative Information"),
    tuple("204", "No Content"),
    tuple("205", "Reset Content"),
    tuple("206", "Partial Content"),
    tuple("207", "Multi-Status"),
    tuple("208", "Already Reported"),
    tuple("300", "Multiple Choices"),
    tuple("301", "Moved Permanently"),
    tuple("302", "Found"),
    tuple("303", "See Other"),
    tuple("304", "Not Modified"),
    tuple("305", "Use Proxy"),
    tuple("307", "Temporary Redirect"),
    tuple("400", "Bad Request"),
    tuple("401", "Unauthorized"),
    tuple("402", "Payment Required"),
    tuple("403", "Forbidden"),
    tuple("404", "Not Found"),
    tuple("405", "Method Not Allowed"),
    tuple("406", "Not Acceptable"),
    tuple("407", "Proxy Authentication Required"),
    tuple("408", "Request Timeout"),
    tuple("409", "Conflict"),
    tuple("410", "Gone"),
    tuple("411", "Length Required"),
    tuple("412", "Precondition Failed"),
    tuple("413", "Request Entity Too Large"),
    tuple("414", "Request-URI Too Large"),
    tuple("415", "Unsupported Media Type"),
    tuple("416", "Request Range Not Satisfiable"),
    tuple("417", "Expectation Failed"),
    tuple("418", "I'm a teapot"),
    tuple("422", "Unprocessable Entity"),
    tuple("423", "Locked"),
    tuple("424", "Failed Dependency"),
    tuple("425", "No code"),
    tuple("426", "Upgrade Required"),
    tuple("428", "Precondition Required"),
    tuple("429", "Too Many Requests"),
    tuple("431", "Request Header Fields Too Large"),
    tuple("449", "Retry with"),
    tuple("500", "Internal Server Error"),
    tuple("501", "Not Implemented"),
    tuple("502", "Bad Gateway"),
    tuple("503", "Service Unavailable"),
    tuple("504", "Gateway Timeout"),
    tuple("505", "HTTP Version Not Supported"),
    tuple("506", "Variant Also Negotiates"),
    tuple("507", "Insufficient Storage"),
    tuple("509", "Bandwidth Limit Exceeded"),
    tuple("510", "Not Extended"),
    tuple("511", "Network Authentication Required")];
    tuple("100", "Continue"),
    tuple("101", "Switching Protocols"),
    tuple("102", "Processing"),
    tuple("200", "OK"),
    tuple("201", "Created"),
    tuple("202", "Accepted"),
    tuple("203", "Non-Authoritative Information"),
    tuple("204", "No Content"),
    tuple("205", "Reset Content"),
    tuple("206", "Partial Content"),
    tuple("207", "Multi-Status"),
    tuple("208", "Already Reported"),
    tuple("300", "Multiple Choices"),
    tuple("301", "Moved Permanently"),
    tuple("302", "Found"),
    tuple("303", "See Other"),
    tuple("304", "Not Modified"),
    tuple("305", "Use Proxy"),
    tuple("307", "Temporary Redirect"),
    tuple("400", "Bad Request"),
    tuple("401", "Unauthorized"),
    tuple("402", "Payment Required"),
    tuple("403", "Forbidden"),
    tuple("404", "Not Found"),
    tuple("405", "Method Not Allowed"),
    tuple("406", "Not Acceptable"),
    tuple("407", "Proxy Authentication Required"),
    tuple("408", "Request Timeout"),
    tuple("409", "Conflict"),
    tuple("410", "Gone"),
    tuple("411", "Length Required"),
    tuple("412", "Precondition Failed"),
    tuple("413", "Request Entity Too Large"),
    tuple("414", "Request-URI Too Large"),
    tuple("415", "Unsupported Media Type"),
    tuple("416", "Request Range Not Satisfiable"),
    tuple("417", "Expectation Failed"),
    tuple("418", "I'm a teapot"),
    tuple("422", "Unprocessable Entity"),
    tuple("423", "Locked"),
    tuple("424", "Failed Dependency"),
    tuple("425", "No code"),
    tuple("426", "Upgrade Required"),
    tuple("428", "Precondition Required"),
    tuple("429", "Too Many Requests"),
    tuple("431", "Request Header Fields Too Large"),
    tuple("449", "Retry with"),
    tuple("500", "Internal Server Error"),
    tuple("501", "Not Implemented"),
    tuple("502", "Bad Gateway"),
    tuple("503", "Service Unavailable"),
    tuple("504", "Gateway Timeout"),
    tuple("505", "HTTP Version Not Supported"),
    tuple("506", "Variant Also Negotiates"),
    tuple("507", "Insufficient Storage"),
    tuple("509", "Bandwidth Limit Exceeded"),
    tuple("510", "Not Extended"),
    tuple("511", "Network Authentication Required")];

    void main(string[] args) {
    auto result = (1 < args.length)?
    statusCode.filter!(x => x[0].startsWith(args[1])).array:
    statusCode;
    const result = (1 < args.length)?
    statusCode.filter!(x => x[0].startsWith(args[1])).array:
    statusCode;

    foreach (x; result)
    writeln(x[0], ": ", x[1]);
    foreach (x; result)
    writeln(x[0], ": ", x[1]);
    }
  2. psihy revised this gist Feb 21, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.d
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    import std.algorithm, std.array, std.stdio, std.typecons;

    immutable statusCode = [
    tuple("100", "Continue"),
    tuple("100", "Continue"),
    tuple("101", "Switching Protocols"),
    tuple("102", "Processing"),
    tuple("200", "OK"),
  3. psihy created this gist Feb 21, 2013.
    70 changes: 70 additions & 0 deletions gistfile1.d
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,70 @@
    import std.algorithm, std.array, std.stdio, std.typecons;

    immutable statusCode = [
    tuple("100", "Continue"),
    tuple("101", "Switching Protocols"),
    tuple("102", "Processing"),
    tuple("200", "OK"),
    tuple("201", "Created"),
    tuple("202", "Accepted"),
    tuple("203", "Non-Authoritative Information"),
    tuple("204", "No Content"),
    tuple("205", "Reset Content"),
    tuple("206", "Partial Content"),
    tuple("207", "Multi-Status"),
    tuple("208", "Already Reported"),
    tuple("300", "Multiple Choices"),
    tuple("301", "Moved Permanently"),
    tuple("302", "Found"),
    tuple("303", "See Other"),
    tuple("304", "Not Modified"),
    tuple("305", "Use Proxy"),
    tuple("307", "Temporary Redirect"),
    tuple("400", "Bad Request"),
    tuple("401", "Unauthorized"),
    tuple("402", "Payment Required"),
    tuple("403", "Forbidden"),
    tuple("404", "Not Found"),
    tuple("405", "Method Not Allowed"),
    tuple("406", "Not Acceptable"),
    tuple("407", "Proxy Authentication Required"),
    tuple("408", "Request Timeout"),
    tuple("409", "Conflict"),
    tuple("410", "Gone"),
    tuple("411", "Length Required"),
    tuple("412", "Precondition Failed"),
    tuple("413", "Request Entity Too Large"),
    tuple("414", "Request-URI Too Large"),
    tuple("415", "Unsupported Media Type"),
    tuple("416", "Request Range Not Satisfiable"),
    tuple("417", "Expectation Failed"),
    tuple("418", "I'm a teapot"),
    tuple("422", "Unprocessable Entity"),
    tuple("423", "Locked"),
    tuple("424", "Failed Dependency"),
    tuple("425", "No code"),
    tuple("426", "Upgrade Required"),
    tuple("428", "Precondition Required"),
    tuple("429", "Too Many Requests"),
    tuple("431", "Request Header Fields Too Large"),
    tuple("449", "Retry with"),
    tuple("500", "Internal Server Error"),
    tuple("501", "Not Implemented"),
    tuple("502", "Bad Gateway"),
    tuple("503", "Service Unavailable"),
    tuple("504", "Gateway Timeout"),
    tuple("505", "HTTP Version Not Supported"),
    tuple("506", "Variant Also Negotiates"),
    tuple("507", "Insufficient Storage"),
    tuple("509", "Bandwidth Limit Exceeded"),
    tuple("510", "Not Extended"),
    tuple("511", "Network Authentication Required")];

    void main(string[] args) {
    auto result = (1 < args.length)?
    statusCode.filter!(x => x[0].startsWith(args[1])).array:
    statusCode;

    foreach (x; result)
    writeln(x[0], ": ", x[1]);
    }