text:
Output the current time in ascii art
Challenge
Your task is to output the time (in 12 hour time) in ascii art.
All characters that will be used are as follows:
  ___    __   ___    ____    _  _     _____     __    ______
 / _ \  /_ | |__ \  |___ \  | || |   | ____|   / /   |____  |
| | | |  | |    ) |   __) | | || |_  | |__    / /_       / /
| | | |  | |   / /   |__ <  |__   _| |___ \  | '_ \     / /
| |_| |  | |  / /_   ___) |    | |    ___) | | (_) |   / /
 \___/   |_| |____| |____/     |_|   |____/   \___/   /_/

   ___     ___
  / _ \   / _ \                                _
 | (_) | | (_) |   __ _ _ __    _ __ _ __     (_)
  > _ <   \__, |  / _` | '  \  | '_ \ '  \     _
 | (_) |    / /   \__,_|_|_|_| | .__/_|_|_|   (_)
  \___/    /_/                 |_|

(For each number/symbol individually, consult this gist).
You will receive input in an array of the form:

[hours, minutes, 'am/pm']. For example, [4, 57, 'am'], with single quotes only used for am/pm
or "hours-minutes-am/pm". For example, "4-56-am"
or [hours, 'minutes', 'am/pm'] for languages that cannot handle leading zeroes on numbers. For example, [4, '07', 'am']

You may use either input method.
Output will be in the form 1  2 : 5  9 am, where there is one initial space, two spaces between each number (in the gist, each number already has one space on each side), one space between : (colon) and the neighbouring numbers, and one space between the last number and am/pm, with an optional leading and/or trailing newline. All spaces are between the right-most point of the symbol on the left and the left-most point of the symbol on the right.
Implicit output is allowed.
Lowest byte size wins.
The am/pm are to be aligned such that the bottom of the p in pm is aligned with the bottom of the rest of the output, that is, the undercore denoting the top of am/pm starts on the third line down (not counting a leading newline).
The colon is to be aligned such that it's first character (an underscore) starts on the second line down (not counting a leading newline).
For minutes < 10, output the minutes with a leading 0 (you should receive this in the input). For example, [8, 04, 'pm'] -> 8 : 0  4 pm.
You must not fetch the data for the numbers from a library or external resource. All data must be contained within the program.
For example, for the input [12, 47, 'am'], the output would be as follows:
  __    ___          _  _      ______
 /_ |  |__ \    _   | || |    |____  |
  | |     ) |  (_)  | || |_       / /   __ _ _ __
  | |    / /    _   |__   _|     / /   / _` | '  \
  | |   / /_   (_)     | |      / /    \__,_|_|_|_|
  |_|  |____|          |_|     /_/

(If you see any edge cases that you can't decide what to do with, please post in comments and I will add them to examples).

Possible duplicate of Render "Digital Clock Style" Numbers

@Mego you reckon? That question simply says render (any) number as (very) basic ascii art. This question beefs up the ascii art, adds the am/pm and colon, and specifies input with an array with a mix of types.

Specifically: that question is clock-style numbers. This question is actual time, with all the right formatting.

The different format of the numbers and the addition of the colon and am/pm do little to differentiate the challenges imo. The main part of the challenge is still converting integers to ascii art.

So, [12, 47, 'pm'] should output 12:47 am?

@Mego I don't think this is a duplicate. The other challenge has that ultra simple formatting (even compressable as binary). This one will probably get more kolmogorov-complexity-like answers.

@wizzwizz4 aaargh! fixed. thanks for the heads up.

How do we receive arguments in languages without arrays?  Or with arrays but without tuples?  (Your example 'array' has elements of different types, unlike arrays in just about any language that exists)

@TobySpeight would "12-47-am" work in most languages?

@MathiasFoster I would recommend that you allow any input (within reason), but that you have the deciding vote on it, and if somebody uses input that trivialises the question, tell them and enforce it.

I guess the program has to output a leading 0 for the number of minutes, if needed? (e.g. 10, 9, 'am' => 10:09am). What about leading 0 for hours (e.g. 8, 9, 'am')? Have to insert 0? Have to insert a space? Have to insert either a space or zero? Can assume the input already contains the leading zero or space?

@anatolyg question updated. basically no leading 0 for hours, there is one for minutes but you'll receive it in the input, so treat it as normal.

Can we have trailing space in the output?

@JAtkin thats fine, as long as it looks exactly as it should.

Perl, 592 579 540 522 510 bytes
Under a sector!
($L,$C,$b)=unpack"W/aW/aB*",q!12346677889999 _|/\)(
'<,>.` PP¨
¨@T @ôäð˜SÀ§€fÌU`à¨Àäð'€GÖf`3 X½`fÍ5 s Î|½`gËÖ— $¡))õ™˜À8Sô BÁªx~O àÔýåËþÏÃÆ~O‡ŸY¬Àf s
½`À*õŸ/X8|½`p>^€<¯åkgúºÖ·ÓÊ¸°ªÀj® kª¸•p¸å\×   ô!;@c=map{$i<<=$_-$P if$_>$P;$P=$_;sprintf"%${l}b",$i++}$L=~/./g;while($b){$b=~s/^$c[$_]// and$g.=($C=~/./sg)[$_]for 0..$#c}$_=pop;s/-/:/;y/apm-/;</d;for$a(0..5){map{$o.=substr((split$/,$g)[$a],($x=-48+ord)*12,('6356766766099'=~/./g)[$x]+3)}/./g;$o.=$/}print$o

This program expects the time in the 2nd format ("12-34-am") as a commandline argument.
Commented:
($L,$C,$b) = unpack "W/aW/aB*",             # extract code lengths, chars, and bitstream
    q!12346677889999 _|/\)(
'<,>.` PP¨
¨@T @ôäð˜SÀ§€fÌU`à¨Àäð'€GÖf`3 X½`fÍ5 s Î|½`gËÖ— $¡))õ™˜À8Sô BÁªx~O àÔýåËþÏÃÆ~O‡ŸY¬Àf s
½`À*õŸ/X8|½`p>^€<¯åkgúºÖ·ÓÊ¸°ªÀj® kª¸•p¸å\×   ô!;
@c = map {                                  # reconstruct huffman prefix codes
    $i <<= $_-$P if $_ > $P;                # increase code size
    $P = $_;                                # keep track of previous code
    sprintf "%${l}b", $i++                  # append code as bitstring
}
$L=~/./g;                                   # canonical huffman prefix lengths
while ( $b ) {                              # decompress font
        $b =~ s/^$c[$_]//                   # match and strip prefix code
        and $g .= ($C=~/./sg)[$_]           # append char for prefix code
    for 0..$#c                              # iterate prefix codes in order
}                                           # luckily we can omit checking trailing bytes

$_ = pop;                                   # get cmdline arg "12-34-am"
s/-/:/;                                     # ord(':')-ord('0')=10
y/apm-/;</d;                                # 'a'-> chr(11), 'p' -> chr(12), strip -,m
for $a (0..5) {                             # iterate 6 output lines
    map {                                   # iterate each char in input
        $o .= substr(
            ( split $/, $g )[$a],           # grab line $a
            ( $x=-48+ord ) * 12,            # $x=glyph index, 12=glyph width
            ('6356766766099'=~/./g)[$x]+3   # glyph display width
        )
    } /./g;
    $o .= $/                                # append newline
}
print $o                                    # output

Note that due to character encoding issues, when you paste the above code in a file, the output may be somewhat malformed. So here's the golfed version, base-64 encoded. Copy it, and paste it into base64 -d > 510.pl:
KCRMLCRDLCRiKT11bnBhY2siVy9hVy9hQioiLHEhDjEyMzQ2Njc3ODg5OTk5DiBffC9cKSgKJzws
Pi5gFQBQAVACqAIgCqgBQBVUAqAFQAH05PAOmANTwBqngGbMBlVgHOAaqMDk8AcngEfWZmAzAA9Y
Ar1gZs0DNQBzoAHOBny9YGfL1g+XoAUkoSkp9ZmYDMAHOANT9A1Cwap4Bn5PABzgH9T9AeV/GBAB
y/7Pw8Z+Tx+Hn1mswGYAc6AKvWAMwCr1gZ8vWAc4Bny9YA5wPl6APK/lrWtn+rrWt9PKuAawBqrA
aq4AawGquAeVcA64AeVcAdcAAAABrfQhO0BjPW1hcHskaTw8PSRfLSRQIGlmJF8+JFA7JFA9JF87
c3ByaW50ZiIlJHtsfWIiLCRpKyt9JEw9fi8uL2c7d2hpbGUoJGIpeyRiPX5zL14kY1skX10vLyBh
bmQkZy49KCRDPX4vLi9zZylbJF9dZm9yIDAuLiQjY30kXz1wb3A7cy8tLzovO3kvYXBtLS87PC9k
O2ZvciRhKDAuLjUpe21hcHskby49c3Vic3RyKChzcGxpdCQvLCRnKVskYV0sKCR4PS00OCtvcmQp
KjEyLCgnNjM1Njc2Njc2NjA5OSc9fi8uL2cpWyR4XSszKX0vLi9nOyRvLj0kL31wcmludCRv

Here's the font I'm using. I've spaced the glyphs 12 characters apart
(the size of the am/pm) for easy indexing.
   ___        __          ___         ____        _  _        _____         __        ______       ___         ___
  / _ \      /_ |        |__ \       |___ \      | || |      | ____|       / /       |____  |     / _ \       / _ \      _
 | | | |      | |           ) |        __) |     | || |_     | |__        / /_           / /     | (_) |     | (_) |    (_)          __ _ _ __   _ __ _ __
 | | | |      | |          / /        |__ <      |__   _|    |___ \      | '_ \         / /       > _ <       \__, |     _          / _` | '  \ | '_ \ '  \
 | |_| |      | |         / /_        ___) |        | |       ___) |     | (_) |       / /       | (_) |        / /     (_)         \__,_|_|_|_|| .__/_|_|_|
  \___/       |_|        |____|      |____/         |_|      |____/       \___/       /_/         \___/        /_/                              |_|

This font is 592 bytes.
The previous approach used a few variations on RLE compression to reduce this to 353 bytes, at the cost of 78 bytes decompression code.
The Huffman coding compresses the font to 221 bytes at the cost of 154 bytes for the decompression algorithm.

Darn it! I really want string compression for haskell..

Haskell, 932 699 bytes
Yay, under 700 bytes!!
t=transpose
i=intercalate
l=lines
u=unlines
s=show
c(h,m,a)=u$t$l(i(r"!!\n!!\n")(map d(s h++':':(if m<10 then '0':s m else s m)))++r"!!"++(d$a!!0))
e s z n=i s$splitOn z n
r=e"   ""!"
d 'a'=b 10
d 'p'=b 11
d ':'=b 12
d n=b$read[n]
b n=splitOn(r"!!")(u$t$l$r$e" |""@"$e"___""$"$e"_|""~"$e"!!""*"$e"_ ""#""  $! __!$! $_! # _!  $__!  __! $$! $!  $*****  \n / #\\  /_@@_#\\ @$ \\ @@|@!| $~!/ /!|$#@  / #\\!/ #\\****!  #\n|@@@ @@! )@!__)@@@|@#@@__! / /_* / / @ (_)@@ (_)@  _###__! #_##__!(_)\n|@@@ @@!/ /!|_#< @__!~@$ \\ @ '#\\!  / /! > #<!\\__,@ / _`@ '  \\ @ '#\\ '  \\!#\n|@~@ @@  / /_!$)@!@@! $)@@ (_)@!/ /!@ (_)@! / /  \\__,~~~~@ .__/~~~ (_)\n \\$/!|~@$~@$_/! @~!|$_/!\\$/!/_/*\\$/! /_/**!@~** ")!!n

Somewhat ungolfed
module Clock where
import Data.Lists

main :: IO ()
main = putStr $ clock (5,05,"am")

clock :: (Int, Int, String) -> String
clock (h,m,a) | m <- if m < 10 then '0':show m else show m
              , hm <- intercalate "      \n      \n" (map digit (show h ++ ':' :m))
              =  unlines $ transpose $ lines (hm ++ "      "++(digit$a!!0))

digit :: Char -> String
digit 'a' = numbers 10
digit 'p' = numbers 11
digit ':' = numbers 12
digit n = numbers (read [n])

numbers :: Int -> String
numbers n = splitOn "      " (unlines $ transpose $ lines "  ___    __   ___    ____    _  _     _____     __    ______    ___     ___                                \n / _ \\  /_ | |__ \\  |___ \\  | || |   | ____|   / /   |____  |  / _ \\   / _ \\                             _ \n| | | |  | |    ) |   __) | | || |_  | |__    / /_       / /  | (_) | | (_) |  __ _ _ __    _ __ _ __   (_)\n| | | |  | |   / /   |__ <  |__   _| |___ \\  | '_ \\     / /    > _ <   \\__, | / _` | '  \\  | '_ \\ '  \\   _ \n| |_| |  | |  / /_   ___) |    | |    ___) | | (_) |   / /    | (_) |    / /  \\__,_|_|_|_| | .__/_|_|_| (_)\n \\___/   |_| |____| |____/     |_|   |____/   \\___/   /_/      \\___/    /_/                |_|             ") !! n

How it works
(This is mostly how the ungolfed program works)
clock :: (Int, Int, String) -> String
clock (h,m,a) | m <- if m < 10 then '0':show m else show m
              , hm <- intercalate "      \n      \n" (map digit (show h ++ ':' :m))
              =  unlines $ transpose $ lines (hm ++ "      "++(digit$a!!0))

clock takes a tuple of the time and returns a string. m is the current minute with the leading 0 added if it is <10. hm is the hours and minutes joined with a :. The last thing it does is transpose the output.
digit :: Char -> String
digit 'a' = numbers 10
digit 'p' = numbers 11
digit ':' = numbers 12
digit n = numbers (read [n])

Fairly simple here. digit is a function that maps the chars to locations in the stored string.
numbers :: Int -> String
numbers n = splitOn "      " (unlines $ transpose $ lines  replace" |""@"$replace"___""$"$replace"_|""~"$replace"!!""*"$replace"_ ""#""  $! __!$! $_! # _!  $__!  __! $$! $!  $*****  \n / #\\  /_@@_#\\ @$ \\ @@|@!| $~!/ /!|$#@  / #\\!/ #\\****!  #\n|@@@ @@! )@!__)@@@|@#@@__! / /_* / / @ (_)@@ (_)@  _###__! #_##__!(_)\n|@@@ @@!/ /!|_#< @__!~@$ \\ @ '#\\!  / /! > #<!\\__,@ / _`@ '  \\ @ '#\\ '  \\!#\n|@~@ @@  / /_!$)@!@@! $)@@ (_)@!/ /!@ (_)@! / /  \\__,~~~~@ .__/~~~ (_)\n \\$/!|~@$~@$_/! @~!|$_/!\\$/!/_/*\\$/! /_/**!@~** ")!!n

This is the magic stored string.
The only real change between the golfed and ungolfed programs is that the golfed program adds some string compression by replacing some common char patterns with !@$. The original data string was 667 bytes, after the replace compression it is down to 390 bytes

C++, 938 Bytes
Revised version with some basic compression of input data: Test here
#include <stdio.h>
#include <time.h>
int main(){char e[]="!1`2!3`1!2`1!4`2!4`!1`!4`4!4`1!3`5!4`2!4`2!35^!`!]!1^`!}!}`1!]!1}`2!]!1}!}1!}!2}!`3}!2^!^!2}`3!1}!2^!`!]!2^!`!]!31`!}!}!}!}!1}!}!3*!}!2`1*!}!}!}1!}`!1}!}`1!3^!^`!6^!^!2}!)`*!}!}!)`*!}!2`1!`!`!`1!3`!`1!`!`1!4)`*}!}!}!}!1}!}!2^!^!2}`1!=!1}`1!2`}!}`2!]!1}!(`!]!4^!^!4?!`!=!2]`1-!}!1^!`a!}!(!1]!1}!(`!]!(!1]!4`!}!}`}!}!1}!}!1^!^`!2`2*!}!3}!}!3`2*!}!}!)`*!}!2^!^!4}!)`*!}!3^!^!2]`1-`}`}`}`}!}!/`1^`}`}`}!2)`*!]`2^!2}`}!}`3}!}`3^!4}`}!2}`3^!2]`2^!2^`^!6]`2^!3^`^!16}`}!14",l[]="8578988998>?3",f[666],*q=f,*p=e,c,r;time_t z;time(&z);tm*u=localtime(&z);while(*p){if(*p>47&&*p<58){r=*p++-48;if(*p>47&&*p<58)r=r*10+*p++-48;while(r--)*q++=c;}else{*q++=c=*p++==94?48:p[-1];}}c=u->tm_hour;sprintf(e,"%02d<%02d%c",c%12,u->tm_min,':'+c/12);for(int s,n,o,r=0;r<6;r++){for(q=e;*q;q++){o=r*111;for(n=0; n<*q-48;n++)o+=l[n]-48;s=l[n]-48;for(n=o;n<o+s;n++)putchar(f[n]-1);}putchar('\n');}return 0;}

The headers for this submission don't have all that much influence on the byte size when compared to the data required, so this could actually have a fair chance at winning.

Bash + GNU utilities + figlet, 134
Not sure if figlet is allowed or not, but it does seem to provide the right fonts - big for the digits and small for the : and {a,p}m:
f=figlet\ -f
b()(date +%$1|sed 's/./& /g'|$f big)
b -I|paste - <(echo "    ";$f small ": ") <(b M) <(echo;date +%P|$f small)|tr \\t \

The rest is just getting the right info from date and shuffling the formating around so it looks right:
  ___          _____    ___
 / _ \    _   | ____|  / _ \
| (_) |  (_)  | |__   | | | |   __ _ _ __
 > _ <    _   |___ \  | | | |  / _` | '  \
| (_) |  (_)   ___) | | |_| |  \__,_|_|_|_|
 \___/        |____/   \___/

Figlet may be installed on Ubuntu with sudo apt-get install figlet.

oooh didn't think of this loophole. I'll edit the question to make sure that the character data is included in the program, but keep your submission and label it inactive - it's still a good one.

I did however use figlet to get the data for the numbers, so +1 for figuring that out :)

Just to make it clear: fonts cannot be loaded from external sources or from libraries.

JavaScript (ES6), 994 985 bytes
Terrible attempt with raw data not compressed at all, and a very tacky method for outputting.
But hey... it's only my second codegolf answer!
d="   ___   !  / _ \\  ! | | | | ! | | | | ! | |_| | !  \\___/  0  __  ! /_ | !  | | !  | | !  | | !  |_| 0  ___   ! |__ \\  !    ) | !   / /  !  / /_  ! |____| 0  ____   ! |___ \\  !   __) | !  |__ <  !  ___) | ! |____/  0  _  _    ! | || |   ! | || |_  ! |__   _| !    | |   !    |_|   0  _____  ! | ____| ! | |__   ! |___ \\  !  ___) | ! |____/  0    __   !   / /   !  / /_   ! |  _ \\  ! | (_) | !  \\___/  0  ______  ! |____  | !     / /  !    / /   !   / /    !  /_/     0   ___   !  / _ \\  ! | (_) | !  > _ <  ! | (_) | !  \\___/  0   ___   !  / _ \\  ! | (_) | !  \\__, | !    / /  !   /_/   0   ! _ !(_)! _ !(_)!   0!! __ _ _ __ !/ _` | '  \\!\\__,_|_|_|_|!0!! _ __ _ __ !| '_ \\ '  \\!| .__/_|_|_|!|_|".split(0);
f=a=>{t="toString",s="split",h=a[0][t]()[s](""),m=a[1][s](""),p=a[2]=='am'?11:12,g=h.length>1?1:0,r="";for(i=0;i<6;i++){r+=d[h[0]][s]('!')[i];r+=(g&&1)?d[h[1]][s]('!')[i]:"";r+=d[10][s]('!')[i]+d[m[0]][s]('!')[i]+d[m[1]][s]('!')[i]+d[p][s]('!')[i]+"\n"}return r}

Old submission (994 bytes):
d=["   ___   !  / _ \\  ! | | | | ! | | | | ! | |_| | !  \\___/  ","  __  ! /_ | !  | | !  | | !  | | !  |_| ","  ___   ! |__ \\  !    ) | !   / /  !  / /_  ! |____| ","  ____   ! |___ \\  !   __) | !  |__ <  !  ___) | ! |____/  ","  _  _    ! | || |   ! | || |_  ! |__   _| !    | |   !    |_|   ","  _____  ! | ____| ! | |__   ! |___ \\  !  ___) | ! |____/  ","    __   !   / /   !  / /_   ! |  _ \\  ! | (_) | !  \\___/  ","  ______  ! |____  | !     / /  !    / /   !   / /    !  /_/     ","   ___   !  / _ \\  ! | (_) | !  > _ <  ! | (_) | !  \\___/  ","   ___   !  / _ \\  ! | (_) | !  \\__, | !    / /  !   /_/   ","   ! _ !(_)! _ !(_)!   ","!! __ _ _ __ !/ _` | '  \\!\\__,_|_|_|_|!","!! _ __ _ __ !| '_ \\ '  \\!| .__/_|_|_|!|_|"];
f=a=>{
    t="toString",s="split",h=a[0][t]()[s](""),m=a[1][s],p=(a[2]=='am')?11:12,g=(h.length>1)?1:0,r="";
    for(i=0;i<6;i++){
        r+=d[h[0]].s('!')[i];
        r+=g&&1?d[h[1]].s('!')[i]:"";
        r+=d[10].s('!')[i]+d[m[0]].s('!')[i]+d[m[1]].s('!')[i]+d[p].s('!')[i]+"\n"
    }
return r
}

Split into lines to make it easier to read.
Basically:
var f = function (a) {
  hours = a[0].toString().split(""), // convert hours to a string then array to
                                    // handle single and and double numbers
  minutes = a[1].split(""), // ditto with minutes
  period = a[2] == "am" ? 11 : 12, // if it is am, get data[11], if pm, get data[12]
  g = hours.length > 1 ? 1 : 0, // if hours > 9, then g is true
  r = ""; // the string that will be returned
for (i = 0; i < 6; i++) {
    r += data[hours[0]].split("!")[i]; // add the first digit of hours to r
    r += g && 1 ? data[hours[1]].split("!")[i] : ""; // if g is true, add the second
                                                    //digit of hours to r
    r += data[10].split("!")[i] + // colon
    data[minutes[0]].split("!")[i] + // first digit of minutes
    data[minutes[1]].split("!")[i] + // second digit of minutes
    data[period].split("!")[i] + // am/pm
    "\n"; // and finally linebreak.
  } // entire loop repeated six times, each iteration adds one line to the string
return r; // return the string
};

Python 3, 1085 1072 bytes
Golfed
def f(h,c="",n=["   ___   @  / _ \  @ | | | | @ | | | | @ | |_| | @  \___/  ","  __  @ /_ | @  | | @  | | @  | | @  |_| ","  ___   @ |__ \  @    ) | @   / /  @  / /_  @ |____| ","  ____   @ |___ \  @   __) | @  |__ <  @  ___) | @ |____/  ","  _  _    @ | || |   @ | || |_  @ |__   _| @    | |   @    |_|   ","  _____  @ | ____| @ | |__   @ |___ \  @  ___) | @ |____/  ","    __   @   / /   @  / /_   @ |  _ \  @ | (_) | @  \___/  ","  ______  @ |____  | @     / /  @    / /   @   / /    @  /_/     ","   ___   @  / _ \  @ | (_) | @  > _ <  @ | (_) | @  \___/  ","   ___   @  / _ \  @ | (_) | @  \__, | @    / /  @   /_/   ","   @ _ @(_)@ _ @(_)@   ","            @            @ __ _ _ __ @/ _` | '  \@\__,_|_|_|_|@            ","            @            @ _ __ _ __ @| '_ \ '  \@| .__/_|_|_|@|_|"]):
 for i in range(6):
  for j in range(3):
   if j<2:
    x=int(h[j]);d=x//10;u=x%10
    if d>0 or j>0:c+=n[d].split("@")[i]
    c+=n[u].split("@")[i]
    if j==0:c+=" "+n[10].split("@")[i]+" "
   else:y=11 if h[j]=="am" else 12;c+=" "+n[y].split("@")[i]
  c+="\n"
 return c

Ungolfed
import os
from time import ctime

def asciiClock(hour):
    num = ["   ___   @  / _ \  @ | | | | @ | | | | @ | |_| | @  \___/  @","  __  @ /_ | @  | | @  | | @  | | @  |_| @",
   "  ___   @ |__ \  @    ) | @   / /  @  / /_  @ |____| @","  ____   @ |___ \  @   __) | @  |__ <  @  ___) | @ |____/  @",
   "  _  _    @ | || |   @ | || |_  @ |__   _| @    | |   @    |_|   @","  _____  @ | ____| @ | |__   @ |___ \  @  ___) | @ |____/  @",
   "    __   @   / /   @  / /_   @ |  _ \  @ | (_) | @  \___/  @","  ______  @ |____  | @     / /  @    / /   @   / /    @  /_/     @",
   "   ___   @  / _ \  @ | (_) | @  > _ <  @ | (_) | @  \___/  @","   ___   @  / _ \  @ | (_) | @  \__, | @    / /  @   /_/   @",
   "   @ _ @(_)@ _ @(_)@   @","            @            @ __ _ _ __ @/ _` | '  \@\__,_|_|_|_|@            @",
   "            @            @ _ __ _ __ @| '_ \ '  \@| .__/_|_|_|@|_|@"]
    clock = ""
    for i in range(6):
        for j in range(3):
            if j < 2:
                x = int(hour[j])
                d = x // 10
                u = x % 10
                if d > 0 or j > 0:
                    clock += num[d].split("@")[i]
                clock += num[u].split("@")[i]
                if j == 0:
                    clock += " " + num[10].split("@")[i] + " "
            else:
                y = 11 if hour[j] == "am" else 12
                clock += " " + num[y].split("@")[i]
        clock += "\n"
    return clock

previousMinute = -1
while True:
    hour = ctime().split()[3].split(":")
    h = int(hour[0])
    m = hour[1]
    x = "am" if h < 12 else "pm"
    if h > 12:
        h -= 12
    if  previousMinute != m:
        os.system("clear") # if using Windows change to "cls"
        print(asciiClock([h, m, x]))
    previousMinute = m


text:
Enhanced Builder Pattern, verified at compile time
Question: can you design a Builder Pattern API which verifies at compile time that every field is set exactly once?
To be eligible, the size of the compiler output should not be exponential in the number of fields. The best solution will be the shortest implementation for a class of 22 fields.

Example of a possible surface API in java
Given an class for immutable data structure such as this one:
public class Human {
  private final String name;
  private final Int age;
  private final Double money;

  public Human(String name, Int age, Double money) {
    this.name = name;
    this.age = age;
    this.money = money;
  }

  public String getName() { return name; }
  public Int getAge() { return age; }
  public Double getMoney() { return money; }
}

The goal is to design an API to construct instances this Humain class with the following requirements, checked at compile time (the code in example is just a possible design, you can come up with anything that is equivalent in term of functionally):

Possible to set parameters in any order:
Human h = HumanBuilder().withName("n").withMoney(0.15).withAge(1).build();
Human g = HumanBuilder().withName("n").withAge(1).withMoney(0.15).build();

Possible to set parameters in different places of the code:
// Given appropriate takesCareOfTheMan & takesCareOfTheMoney methods
Human h = takesCareOfTheMan(takesCareOfTheMoney(HumanBuilder())).build();
Human g = takesCareOfTheMoney(takesCareOfTheMan(HumanBuilder())).build();

Impossible to set the same parameter twice:
// This should not compile:
// Human h = HumanBuilder().withName("n").withAge(1).withAge(2).withMoney(0.15).build();

Impossible to omit a parameter:
// This should not compile:
// Human h = HumanBuilder().withName("n").withMoney(0.15).build();

Welcome to Programming Puzzles & Code Golf! Please note that challenges without an objective winning criterion are offtopic on this site. So you should edit this challenge asap otherwise it is gonna get closed very soon. For future challenges I recommend using the sandbox to get feedback from the community first before you post a challenge.

possible typo, everything in your constructor is set to name

The question seems to contain the design, so what are you asking for when you ask people to make a design?

@DenkerAffe, ok added an objective winning criterion!

@Peter Taylor: the design was just an example, you can come up with anything that is equivalent in term of functionally.

I'm still not sure what you're asking for: the question says that you want a language design, but I can't tell whether your self-posted answer is code, pseudocode, or something else.

@PeterTaylor: Sorry I rephrased the question, I'm not looking for a language design but rather for an API (wrongly called domain-specific language before my last edit). The linked wikipedia page has a few examples of what it could look like, except that they do not provide the verifications I'm looking for.

I'm still confused. Let's try to make things a bit more concrete; you used Java as the example, and it's a language I'm familiar with if a bit out of touch, so... If I wrote a Java answer, what would you expect? A source-to-source compiler which takes the .java file for a class and produces a .java file for a builder? A bytecode-to-source generator which uses reflection? A custom classloader? An annotation processor (if they're sufficiently powerful - I never really grokked apt)? Any of the above? Something else?

As stated, I think this problem is impossible to solve in Java. source-to-source compiler would likely lead to an output exponential in the number of fields, reflection cannot be used not at compile time, custom classloader/annotation processor is pretty much a compiler plugin, which might be considered too close to "building a new language" to solve the problem :)

How about something like this, in Haskell:
{-# LANGUAGE GADTs, DataKinds, KindSignatures, StandaloneDeriving #-}
module Builder ( Human', Human, mkHuman, unHuman
               , withName, withAge, withMoney
               ) where

data Optional (b :: Bool) (a :: *) where
    Missing :: Optional False a
    Present :: a -> Optional True a
deriving instance (Show a) => Show (Optional b a)

data Human' b1 b2 b3 where
    MkHuman :: Optional b1 String -> Optional b2 Int -> Optional b3 Double -> Human' b1 b2 b3
deriving instance Show (Human' b1 b2 b3)

type Human = Human' True True True

mkHuman :: Human' False False False
mkHuman = MkHuman Missing Missing Missing

unHuman :: Human -> (String, Int, Double)
unHuman (MkHuman (Present name) (Present age) (Present money)) = (name, age, money)

withName :: String -> Human' False b2 b3 -> Human' True b2 b3
withName name (MkHuman _ age money) = MkHuman (Present name) age money

withAge :: Int -> Human' b1 False b3 -> Human' b1 True b3
withAge age (MkHuman name _ money) = MkHuman name (Present age) money

withMoney :: Double -> Human' b1 b2 False -> Human' b1 b2 True
withMoney money (MkHuman name age _) = MkHuman name age (Present money)

Example usage:
h1, h2 :: Human
h1 = withName "n" . withMoney 0.15 . withAge 1 $ mkHuman
h2 = withName "n" . withAge 1 . withMoney 0.15 $ mkHuman

takesCareOfTheName :: Human' False b2 b3 -> Human' True b2 b3
takesCareOfTheName = withName "John"

-- This doesn't typecheck
h3 :: Human
h3 = withName "newName" h1

-- Neither does this
h4 :: Human
h4 = withName "n" . withAge 1 $ mkHuman

I haven't made up my mind yet if I want to instead generalize this by having a Builder type indexed by a list of types, and then do setters/getters from that.

Here's a simpler solution that doesn't require any type system extensions: http://lpaste.net/152626 .
Also, the solution you gave is quadratic in the number of fields due to the type signatures

OK here's one, also in Haskell, that is much more extensible: notice how Human is merely a Builder with a specific index of field types.
{-# LANGUAGE GADTs, DataKinds, KindSignatures, StandaloneDeriving #-}
{-# LANGUAGE TypeOperators, TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}
{-# LANGUAGE FlexibleInstances, FlexibleContexts #-}

data Optional (b :: Bool) (a :: *) where
    Missing :: Optional False a
    Present :: a -> Optional True a
deriving instance (Show a) => Show (Optional b a)

data Builder (as :: [*]) (bs :: [Bool]) where
    BNil :: Builder '[] '[]
    BCons :: Optional b a -> Builder as bs -> Builder (a ': as) (b ': bs)

type family Empty_ as where
    Empty_ '[] = '[]
    Empty_ (a ': as) = False ': Empty_ as

type family Full_ as where
    Full_ '[] = '[]
    Full_ (a ': as) = True ': Full_ as

type family Empty builder where
    Empty (Builder as) = Builder as (Empty_ as)

type family Full builder where
    Full (Builder as) = Builder as (Full_ as)

data Tuple as where
    TNil :: Tuple '[]
    (:>) :: a -> Tuple as -> Tuple (a ': as)

infixr 5 :>

fromFull :: Full (Builder as) -> Tuple as
fromFull BNil = TNil
fromFull (BCons (Present x) xs) = x :> fromFull xs

class Buildable as where
    emptyBuilder :: Empty (Builder as)

instance Buildable '[] where
    emptyBuilder = BNil

instance (Buildable as) => Buildable (a ': as) where
    emptyBuilder = BCons Missing emptyBuilder

type Human = Builder '[String, Int, Double]

mkHuman :: Empty Human
mkHuman = emptyBuilder

data Nat = Z | S Nat

data Lookup i as where
    Here :: a -> Lookup Z (a ': as)
    There :: Lookup i as -> Lookup (S i) (a ': as)

type family FillAt i bs where
    FillAt Z (False ': bs) = True ': bs
    FillAt (S i) (b ': bs) = b ': FillAt i bs

class Fill bs (i :: Nat) where
    fill :: Lookup i as -> Builder as bs -> Builder as (FillAt i bs)

instance Fill (False ': bs) Z where
    fill (Here x) (BCons Missing xs) = BCons (Present x) xs

instance (Fill bs i) => Fill (b ': bs) (S i) where
    fill (There k) (BCons x xs) = BCons x $ fill k xs

withName :: (Fill bs Z) => String -> Human bs -> Human (FillAt Z bs)
withName = fill . Here

withAge :: (Fill bs (S Z)) => Int -> Human bs -> Human (FillAt (S Z) bs)
withAge = fill . There . Here

withMoney :: (Fill bs (S (S Z))) => Double -> Human bs -> Human (FillAt (S (S Z)) bs)
withMoney = fill . There . There . Here

unHuman :: Full Human -> (String, Int, Double)
unHuman h = case fromFull h of
    name :> age :> money :> TNil -> (name, age, money)

h1, h2 :: Full Human
h1 = withName "n" . withMoney 0.15 . withAge 1 $ mkHuman
h2 = withName "n" . withAge 1 . withMoney 0.15 $ mkHuman

takesCareOfTheName :: (Fill bs Z) => Human bs -> Human (FillAt Z bs)
takesCareOfTheName = withName "John"

-- -- This doesn't typecheck
-- h3 :: Full Human
-- h3 = withName "newName" h1

-- -- Neither does this
-- h4 :: Full Human
-- h4 = withName "n" . withAge 1 $ mkHuman

import shapeless.<:!<

case class HumanBuilder[A]( name: String, age: Int, money: Double) {

  def withName(name: String)(implicit ev: A <:!< Name): HumanBuilder[A with Name] = this.copy[A with Name](name = name)
  def withAge(age: Int)(implicit ev: A <:!< Age): HumanBuilder[A with Age] = this.copy[A with Age](age = age)
  def withMoney(money: Double)(implicit ev: A <:!< Money): HumanBuilder[A with Money] = this.copy[A with Money](money = money)

  def build()(implicit ev: A =:= Builder with Name with Age with Money): Human = Human(name, age, money)
}

object HumanBuilder {

  def apply(): HumanBuilder[Builder] = HumanBuilder[Builder]("", 0, 0.0)

}

trait Builder
trait Name
trait Age
trait Money

case class Human(name: String, age: Int, money: Double)

Usage
    scala> HumanBuilder().withName("test").withAge(10).withMoney(1.0).build()
res1: puzzle.Human = Human(test,10,1.0)

scala> HumanBuilder().withMoney(3.0).withName("test").withAge(10).build()
res2: puzzle.Human = Human(test,10,3.0)

scala> HumanBuilder().withName("test").withAge(10).withMoney(1.0).withMoney(3.0).build()
<console>:14: error: ambiguous implicit values:
 both method nsubAmbig1 in package shapeless of type [A, B >: A]=> shapeless.package.<:!<[A,B]
 and method nsubAmbig2 in package shapeless of type [A, B >: A]=> shapeless.package.<:!<[A,B]
 match expected type shapeless.<:!<[puzzle.Builder with puzzle.Name with puzzle.Age with puzzle.Money,puzzle.Money]
       HumanBuilder().withName("test").withAge(10).withMoney(1.0).withMoney(3.0).build()
                                                                           ^

scala> HumanBuilder().withName("test").withAge(10).build()
<console>:14: error: Cannot prove that puzzle.Builder with puzzle.Name with puzzle.Age =:= puzzle.Builder with puzzle.Name with puzzle.Age with puzzle.Money.
       HumanBuilder().withName("test").withAge(10).build()

In Scala, you could do the following:
// Or import shapeless._
object Lib {
  trait Nat
  trait Succ[N <: Nat] extends Nat
  trait Z extends Nat
}

object Builder {
  import Lib._

  case class Human(age: Int, name: String, money: Double)

  trait WithAge { def age: Int }
  trait WithName { def name: String }
  trait WithMoney { def money: Double }

  trait HumanBuilder {
    type N <: Nat
    type Next[N0 <: Nat] = this.type { type N = Succ[N0] }

    var age: Int = _
    var name: String = _
    var money: Double = _

    def thiz[A]: A = asInstanceOf[A] // ez typecheck
    def withAge(a: Int): Next[N] with WithAge = { age = a; thiz }
    def withName(n: String): Next[N] with WithName = { name = n; thiz }
    def withMoney(m: Double): Next[N] with WithMoney = { money = m; thiz }
  }

  object HumanBuilder {
    def apply() = new HumanBuilder { type N = Z }

    type WithList = WithAge with WithName with WithMoney
    type WithSize = { type N = Succ[Succ[Succ[Z]]] }

    implicit class Build(hb: HumanBuilder with WithList with WithSize) {
      def build(): Human = Human(hb.age, hb.name, hb.money)
    }
  }
}

Tests:
object Usage extends App {
  import shapeless.test.illTyped
  import Builder._

  illTyped("""
    HumanBuilder()
      .withName("n")
      .withAge(1).withAge(2)
      .withMoney(0.15)
      .build()
  """)

  illTyped("""
    HumanBuilder()
      .withName("n")
      // .withAge(1)
      .withMoney(0.15)
      .build()
  """)

  val h: Human = HumanBuilder()
    .withName("n")
    .withAge(1)
    .withMoney(0.15)
    .build()

  println(h)
}

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Frame this nice ASCII-Art
Introduction
I think everyone agrees that nice pictures have to have a nice frame. But most challenges on this site about ASCII-Art just want the raw picture and don't care about it's preservation.
Wouldn't it be nice if we had a program that takes some ASCII-Art and surrounds it with a nice frame?
The Challenge
Write a program that takes some ASCII-Art as input and outputs it surrounded by a nice frame.
Example:

*****
 ***
  *
 ***
*****

becomes

╔═══════╗
║ ***** ║
║  ***  ║
║   *   ║
║  ***  ║
║ ***** ║
╚═══════╝

You have to use the exact same characters for the frame as in the example: ═ ║ ╔ ╗ ╚ ╝
The top and the bottom of the frame get inserted before the first and after the last line of the input.
The left and rights parts of the frame have to have exact one space padding to the widest line of the input.
There may be no leading or trailing whitespaces in the output. Only a trailing newline is allowed.
You may assume that the input has no unnecessary leading whitespaces.
You may assume that the input has no trailing whitespaces on any line.
You don't have to handle empty input.
The input will only contain printable ASCII-characters and newlines.

Rules

Function or full program allowed.
Default rules for input/output.
Standard loopholes apply.
This is code-golf, so lowest byte-count wins. Tiebreaker is earlier submission.

Happy Coding!
Using some great ASCII-Art, that was produced in any challenge on this site, as input to your program and showing it with a nice frame is highly encouraged!

A non-ASCII frame for ASCII art? Heresy!

@Dennis I like the irony too :)

Very closely related. Same challenge, but only using a single (ASCII) character for the frame.

(I should clarify I don't think it's a dupe. Having to use 6 different characters makes this a lot trickier. The other challenge can be solved by rotating the grid and appending # four times. Adapting such an approach here will be tricky at best, and not viable at worst.)

@MartinBüttner This is indeed a very similar challenge, did not find it before (guess I should have searched for something more than just frame). But I also think its different enough to leave this one open.

This is also a multiline challenge, while the previous challenge was only a single line of text.

@MartinBüttner According to your rules, this question is a duplicated. Quoting from http://meta.codegolf.stackexchange.com/a/3605/14732 :  "[...] the differences seem very minor, if someone did adapt an old answer, the heavy lifting would have been done by the user who answered the previous question.".

@IsmaelMiguel I have won the previous contest and don't see how I could adapt my old answer at all.

@MartinBüttner I can. Just replace the "middle section" with multi-line support. Which is exactly what I did. Check the answers below.

I suspect that DenkerAffe is assuming CP437 or something where the frame chars are also one byte.

CJam, 45 chars / 52 bytes
qN/_z,)[_)'═*N]2*C,3%'╔f+.\4/@@f{Se]'║S@2$N}*

Trying to avoid those expensive 3-byte chars was... interesting.
Try it online
Explanation
qN/                   Split input by newline
_z,                   Zip and get length L, i.e. length of longest line
)                     Increment -> L+1
[_)'═*N]              Make two-element array of "═"*(L+2) and newline
2*                    Double the array, giving ["═"*(L+2) "\n" "═"*(L+2) "\n"]

C,                    range(12), i.e. [0 1 2 ... 11]
3%                    Every third element, i.e. [0 3 6 9]
'╔f+                  Add "╔" to each, giving "╔╗╚╝"
.\                    Vectorised swap with the previous array, giving
                      ["╔" "═"*(L+2) "╗" "\n" "╚" "═"*(L+2) "╝" "\n"]
4/                    Split into chunks of length 4

@@                    Move split input and L+1 to top
f{...}                Map with L+1 as extra parameter...
  Se]                   Pad line to length L+1, with spaces
  '║S                   Put "║" and space before it
  2$N                   Put "║" and newline after it

*                     Join, putting the formatted lines between the top and bottom rows

Haskell, 139 bytes
q=length
g x|l<-lines x,m<-maximum$q<$>l,s<-[-1..m]>>"═"='╔':s++"╗\n"++(l>>= \z->"║ "++z++([q z..m]>>" ")++"║\n")++'╚':s++"╝"

As an example I'm framing snowman "12333321".
*Main> putStrLn $ g " _===_\n (O.O)\n/(] [)\\\n ( : )"
╔═════════╗
║  _===_  ║
║  (O.O)  ║
║ /(] [)\ ║
║  ( : )  ║
╚═════════╝

How it works:
bind
  l: input split into lines
  m: maximum line length
  s: m+2 times ═

build top line
prepend left frame to each line, pad with spaces, append right frame
build bottom line.

JavaScript (ES6), 138 bytes
This is 138 bytes in the IBM866 encoding, which at time of writing is still supported in Firefox, but 152 in UTF-8.
s=>`╔${t='═'.repeat(w=2+Math.max(...(a=s.split`
`).map(s=>s.length)))}╗
${a.map(s=>('║ '+s+' '.repeat(w)).slice(0,w+1)).join`║
`}║
╚${t}╝`

Can you actually encode Javascript using CP437 and still run it? If not, then this isn't actually 138 bytes.

@ӍѲꝆΛҐӍΛПҒЦꝆ Although I couldn't find anything supporting CP437, Firefox currently supports IBM866 which also has these box drawing characters, so I've updated my answer.

Okay, cool. Have an upvote!

Bash, 173 171 150 148  147 bytes, 157 136 134 133 characters
q(){((n=${#2}>n?${#2}:n));};mapfile -tc1 -C q v;for((p=++n+1;p;--p));do z+=═;done;echo ╔$z╗;printf "║ %-${n}s║\n" "${v[@]}";echo ╚$z╝

Multiline:
q() {
    (( n = ${#2} > n ? ${#2} : n))
}
mapfile -tc1 -C q v

for((p=++n+1;p;--p))
do
    z+=═
done

echo ╔$z╗
printf "║ %-${n}s║\n" "${v[@]}"
echo ╚$z╝

Example execution:
bash -c 'q(){((n=${#2}>n?${#2}:n));};mapfile -tc1 -C q v;for((p=++n+1;p;--p));do z+=═;done;echo ╔$z╗;printf "║ %-${n}s║\n" "${v[@]}";echo ╚$z╝'< bear.txt

Sample run from script:
$ cat bear2.txt
     (()__(()
     /       \
    ( /    \  \
     \ o o    /
     (_()_)__/ \
    / _,==.____ \
   (   |--|      )
   /\_.|__|'-.__/\_
  / (        /     \
  \  \      (      /
   )  '._____)    /
(((____.--(((____/mrf
$ ./frame< bear2.txt
╔═══════════════════════╗
║      (()__(()         ║
║      /       \        ║
║     ( /    \  \       ║
║      \ o o    /       ║
║      (_()_)__/ \      ║
║     / _,==.____ \     ║
║    (   |--|      )    ║
║    /\_.|__|'-.__/\_   ║
║   / (        /     \  ║
║   \  \      (      /  ║
║    )  '._____)    /   ║
║ (((____.--(((____/mrf ║
╚═══════════════════════╝

Your example has an emtpy line between the bottom frame and the input which is invalid. The top and bottom frames have to be inserted directly before and after the input (your previous version was fine btw).

Nice!, But you could save approx 5 char if ...?${#2}+2:n)) instead of +1, drop 2 spaces and printf -v z %${n}s; instead of printf -v z " %*.s" $n.

@Sukminder Ok, was already assumnig that, but wanted to make that sure since the input you show does not contain an empty line. I did not demand that you clear the input of leading or traliing empty lines, so you program is perfectly fine.

Perl, 111 characters
(score includes +5 for the interpreter flags)

#!/usr/bin/perl -n0 -aF\n
$n=(sort{$b<=>$a}map length,@F)[0];$l="═"x$n;
print"╔═$l═╗\n",(map{sprintf"║ %-${n}s ║\n",$_}@F),"╚═$l═╝";

First, we find the longest line length $n, by numerically sorting the lengths of all lines.
We set $l to be the header/footer bar to be $n repetitions of the horizontal frame character.
Then we print each line formatted to left-align in a field of width $n, sandwiched in between the frame characters.
Result:
╔═══════════╗
║   |\_/|   ║
║  / @ @ \  ║
║ ( > * < ) ║
║  `>>x<<'  ║
║  /  O  \  ║
╚═══════════╝

AWK, 159 141 bytes
{a[NR,1]=x=length(a[NR]=$0)
m=m<x?x:m}END{for(;i++<m+2;)t=t"═"
for(print"╔"t"╗";j++<NR;)printf"║ %-"m"s ║\n",a[j]
print"╚"t"╝"}

Try it online!
Apparently awk can print Unicode if you can figure out how to get it in the code.
Thanks, @ceilingcat, for pointing out that my code could be rearranged to save 18 bytes.

I'm having so many ideas for awesome pipes now ...

@Sebb That does seem like fun. :)

@ceilingcat This was from before I even knew about TIO :0
Nice catches :)

PHP 5.3, 209 bytes
This only works using the encoding OEM 860. It is an Extended ASCII superset, used in Portuguese DOS versions. Since I'm Portuguese (and I used to love doing these "frames" in Pascal) and this is a standard encoding, I went ahead with this:
<?foreach($W=explode('
',$argv[1])as$v)$M=max($M,strlen($v)+2);printf("É%'Í{$M}s»
º%1\${$M}sº
%2\$s
º%1\${$M}sº
È%1\$'Í{$M}s¼",'',join('
',array_map(function($v)use($M){return str_pad(" $v ",$M);},$W)));

Here's the base64:
PD9mb3JlYWNoKCRXPWV4cGxvZGUoJwonLCRhcmd2WzFdKWFzJHYpJE09bWF4KCRNLHN0cmxlbigkdikrMik7cHJpbnRmKCLilZQlJ+KVkHskTX1z4pWXCuKVkSUxXCR7JE19c+KVkQolMlwkcwrilZElMVwkeyRNfXPilZEK4pWaJTFcJCfilZB7JE19c+KVnSIsJycsam9pbignCicsYXJyYXlfbWFwKGZ1bmN0aW9uKCR2KXVzZSgkTSl7cmV0dXJuIHN0cl9wYWQoIiAkdiAiLCRNKTt9LCRXKSkpOw==

This answer was based on my answer on: https://codegolf.stackexchange.com/a/57883/14732 (the heavy lifting was all made there, just had to twitch a bit).

Impressive to say the least :)

The codes is 209 bytes/characters. 22+58+11+5+11+24+66+12=209 The last 12 is newlines and as it is DOS that means CRLF, or two bytes per newline. The charactercountonline site does not count newlines. Each of the non-ASCII glyphs are 1 byte in OEM 860.

@Sukminder Don't forget that (at least) Windows converts \n into \r\n, when opening the file in ASCII/text mode.

Pyth, 44 chars (58 bytes)
++\╔K*JhheSlR.z\═\╗jbm+\║+.[+;d;J\║.z++\╚K\╝

Explanation
++\╔K*JhheSlR.z\═\╗                          - print out the first line
           lR.z                              -        map(len, all_input())
          S                                  -       sorted(^)
         e                                   -      ^[-1]
       hh                                    -     ^+2
      J                                      -    autoassign J = ^
     *         \═                            -   ^*"═"
    K                                        -  autoassign K = ^
++\╔             \╗                          - imp_print("╔"+^+"╗")

                   jbm+\║+.[+;d;J\║.z        - print out the middle
                   jb                        - "\n".join(V)
                     m             .z        -  [V for d in all_input()]
                      +\║+       \║          -   "║"+V+"║"
                          .[   ;J            -    pad(V, " ", J)
                            +;d              -     " "+d

                                     ++\╚K\╝ - print out the end
                                     ++\╚K\╝ - imp_print("╚"+K+"╝")

Try it here.

Python 3, 119 Bytes
def f(x):
 n='\n';s="║ ";e=" ║";h=(x.find(n)+2)*"═";return"╔"+h+"╗"+n+s+x.replace(n,e+n+s)+e+n+"╚"+h+"╝"

126 bytes
import sys
o=["║ %s ║\n"%j[:-1] for j in sys.stdin]
h="═"*(len(o[0])-3)
print("╔"+h+"╗\n"+"".join(o)+"╚"+h+"╝")

Input:
hello
there
  !

Output:
╔═══════╗
║ hello ║
║ there ║
║   !   ║
╚═══════╝

Welcome to Progamming Puzzles & Code Golf! Nice first answer! You can always write functions instead of full programs (unless explicitly forbidden in the challenge) which might allow you to save some bytes by taking the input as argument. Also you might want to use Python 2, so you can save 2 bytes by going with print"╔"+h+"╗\n"+"".join(o)+"╚"+h+"╝".

Thanks.  I couldn't figure out how to get the high-bytes working in Python2 (probably setting the codec environment variable would work but I'm not sure how that plays into golf byte counts).  The function approach eliminates python2/3 differences but adds a byte in my best approach.

Okay, I got it down to 119 characters as a function; takes input as a string.  My mini-markdown is obviously not up to snuff; Line 1 is the def, the rest (after the colon) is line 2, with a leading space.
def f(x):
n='\n';s="║ ";e=" ║";h=(x.find(n)+2)*"═";return"╔"+h+"╗"+n+s+x.replace(n,e+n+s)+e+n+"╚"+h+"╝"

Just update your post with the new version and the new score (struck the old score out with <s>...</s>). Also you can add <!-- language-all: lang-python --> before your code-block to add syntax highlighting to your code.

This doesn't work if the input is non-rectangular, while the question says that no line will have trailing whitespace.

Python 2, 115 Bytes
def f(i):w='═'*(i.find('\n')+2);return'╔%s╗\n║ %s ║\n╚%s╝'%(w,' ║\n║ '.join(i.split('\n')),w)

Looks shorter than 115 here, but working file includes 3-byte UTF-8 BOM mark signature, bumping it up to 115 bytes. If you were to run it in Python 3 you wouldn't need the BOM and it'd get down to 112 bytes.

Welcome to Programming Puzzles & Code Golf! Unfortunately, your code appears to assume that the input is rectangular, while the question says that no line will have trailing whitespace.

I count 107 bytes. I don't think you need to include the "UTF-8 BOM mark signature".

@CatsAreFluffy Are you using Python2? In Python3 all strings are unicode, but it's trickier with Python2.

Oops, I counted pipes as 2 bytes, but even after using an actual bytecounter, still only 111 bytes. Tell me where those 5 bytes came from.

The UTF-8 BOM is 3 bytes (https://en.wikipedia.org/wiki/Byte_order_mark). My count was one high because my text editor was adding a trailing newline, so my solution is really only 115 bytes. You could leave off the leading BOM bytes and get it down to 112 if you were using Python3 (which counts all strings as unicode). But I don't know how you're seeing only 111 bytes.
btw, here's how I added the BOM:
sed -i '1s/^\(\xef\xbb\xbf\)\?/\xef\xbb\xbf/' codeGolf.py

-3bytes: Switch to Python 3. It works perfectly there. (Tested too!)

C, 290 bytes
Golfed function B, with dependencies; takes input as null-terminated char*
#define l(s) strlen(s)
p(char*s,int n){while(n--)printf(s);}
B(char*s){char*t=strtok(s,"\n");int x=l(t),z=1;while(t=strtok(0,"\n"))z++,x=l(t)>x?l(t):x;p("╔",1);p("=",x+2);p("╗\n",1);while(z--)printf("║ %s", s),p(" ",x-l(s)),p(" ║\n",1),s+=l(s)+1;p("╚",1);p("=",x+2);p("╝\n",1);}

Somewhat-ungolfed function in full program
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 1024

// GOLF-BEGIN =>
#define l(s) strlen(s)
// since multibyte chars don't fit in char: use char* instead
void p (char*s,int n){ while(n--)printf(s); }
void B (char *s){
    char *t = strtok(s,"\n");
    int x=l(t), z=1;
    while(t=strtok(0,"\n"))z++,x=l(t)>x?l(t):x;
    // x is l(longest line), z is #lines
    p("╔",1);p("=",x+2);p("╗\n",1);
    while(z--)printf("║ %s", s),p(" ",x-l(s)),p(" ║\n",1),s+=l(s)+1;
    p("╚",1);p("=",x+2);p("╝\n",1);
}
// <= GOLF-END

int main(int argc, char **argv) {
    char buffer[MAX];
    memset(buffer, 0, MAX);
    FILE *f = fopen(argv[1], "rb");
    fread(buffer, 1, MAX, f);
    B(buffer);
    return 0;
}

input
     _.,----,._
   .:'        `:.
 .'              `.
.'                `.
:                  :
`    .'`':'`'`/    '
 `.   \  |   /   ,'
   \   \ |  /   /
    `\_..,,.._/'
     {`'-,_`'-}
     {`'-,_`'-}
     {`'-,_`'-}
      `YXXXXY'
        ~^^~

output
╔======================╗
║      _.,----,._      ║
║    .:'        `:.    ║
║  .'              `.  ║
║ .'                `. ║
║ :                  : ║
║ `    .'`':'`'`/    ' ║
║  `.   \  |   /   ,'  ║
║    \   \ |  /   /    ║
║     `\_..,,.._/'     ║
║      {`'-,_`'-}      ║
║      {`'-,_`'-}      ║
║      {`'-,_`'-}      ║
║       `YXXXXY'       ║
║         ~^^~         ║
╚======================╝

C golfing tips appreciated!

252 bytes

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Output all the white or black squares of a chessboard
Introduction
This is how a chessboard looks like.

You can see that a1 is a dark square. However, b1 is a light square.
The Task
The challenge is, given dark, light or both, output all the dark, light or all squares with a separator (like a whitespace or a newline). The order of all the squares does not matter.
Test cases
Input: dark
Output: a1 a3 a5 a7 b2 b4 b6 b8
        c1 c3 c5 c7 d2 d4 d6 d8
        e1 e3 e5 e7 f2 f4 f6 f8
        g1 g3 g5 g7 h2 h4 h6 h8

Input: light
Output: a2 a4 a6 a8 b1 b3 b5 b7
        c2 c4 c6 c8 d1 d3 d5 d7
        e2 e4 e6 e8 f1 f3 f5 f7
        g2 g4 g6 g8 h1 h3 h5 h7

Input: both
Output: a1 a2 a3 a4 a5 a6 a7 a8
        b1 b2 b3 b4 b5 b6 b7 b8
        c1 c2 c3 c4 c5 c6 c7 c8
        d1 d2 d3 d4 d5 d6 d7 d8
        e1 e2 e3 e4 e5 e6 e7 e8
        f1 f2 f3 f4 f5 f6 f7 f8
        g1 g2 g3 g4 g5 g6 g7 g8
        h1 h2 h3 h4 h5 h6 h7 h8

Note: I have prettified the output but this is not necessary.
This is code-golf, so the submission with the least amount of bytes wins!

So, something like a2a4a6... would be okay?

@CᴏɴᴏʀO'Bʀɪᴇɴ It does have to contain a seperator, like a whitespace or a newline, so that is invalid.

Can we output a raw 2d matrix? I.e. [[a2,a4,a6,a8],[...]...]

@CᴏɴᴏʀO'Bʀɪᴇɴ Yes, that is allowed

Do light,dark and both have to be input as Strings or can they be represented via any data type?

@W.K.S The input is always light, dark or both. What you do with these values is up to you.

@Adnan So outputs other than light dark or both can have undefined, mean behavior?

@corsiKa Yes, that is correct.

Pyth, 22 21 bytes
-1 byte by @Sp3000
fn%Chz3%sCMT2sM*<G8S8

Under the function %Chz3, dark hashes to 1, light to 0, and both to 2. If we take the parity of the sum of the ords of a chess square (that is, a1 -> [97, 33] -> (97 + 33)%2 = 0, dark squares go to 0, and light to 1. This allows us to filter by inequality.
fn%Chz3%sCMT2sM*<G8S8      implicit: z=input
               *           Cartesian product of
                <G8          first 8 letters in G (alphabet)
                   S8        with [1,...,8] implicitly stringified
             sM*<G8S8      ['a1','a2,...,'a8','b1'...'h8']
f          T               Filter that by gives truthy result to lambda T:
        sCMT                   The sum of the ords of the chars in T,
       %    2                  modulo 2
 n                            does not equal
   Chz                          ord of the first char in z,
  %   3                         modulo 3
                            Implicitly print the list.

Try it here.

21: fn%Chz3%sCMT2sM*<G8S8

@Sp3000 Thanks! Knowing I was using 6 bytes to get it to fit, I should have tried different hashes.

Bash + GNU Utilities, 74
printf %s\\n {a..h}{1..9}|sed -n "`sed '/[db]/a1~2p
/t/a2~2p
c/9/d'<<<$1`"

{a..h}{1..9} is a bash brace expansion that produces all the coordinates for an 8x8 board, plus an extra column 9.  This is important because it makes the row length odd which allows the chequerboard effect.
The printf simply formats each coordinate, one per line.
The built sed expression then deletes all x9 coordinates and then prints either even or odd or both input lines, according to the script input.

JavaScript (SpiderMonkey 30+), 90 85 83 82 bytes
x=>[for(d of"12345678")for(c of"abcdefgh")if(x>'l'^parseInt(c+=d,19)%2|x<'d')c]+''

Returns a comma-separated string of squares. Compatible version for 99 bytes:
x=>([..."12345678"].map(d=>[..."abcdefgh"].map(c=>c+d).filter(s=>x>'l'^parseInt(s,19)%2|x<'d')))+''

Works by enumerating all 64 square names, then parsing them in base 19 to see whether they are light or dark modulo 2.

Good. This is ES7

@edc65 Ah, I couldn't remember. I take it my second version is "only" ES6.

Now ES6 beats ES7

@edc65 You were saying?

It's really terse - beautiful!

... but ES6 is at 82 now

@edc65 I don't suppose we could agree to a draw?

Let us continue this discussion in chat.

JavaScript (ES6), 82 87 98
Anonymous function returning a space separated string of squares.
i=>eval("for(o='',v=190;v<322;)v++%19<8&&i<'d'|v&1^i>'l'?o+=v.toString(19)+' ':o")

TEST

f=i=>eval("for(o='',v=190;v<322;)v++%19<8&&i<'d'|v&1^i>'l'?o+=v.toString(19)+' ':o")

// less golfed

q=i=>{
  // loop over the range of number a0 (base 19) to h8 (base 19)
  for(o='',v=190;v<322;)
  {
    if (v++ %19 < 8) // increment and execute the line below only if second digit in 1..8
      if (i<'d'|v&1^i>'l') // even == light, odd == dark, take both if input is 'both'
        o+=v.toString(19)+' '
  }
  return o
}

document.write('
Both
'+f('both'))
document.write('
Light
'+f('light'))
document.write('
Dark
'+f('dark'))

Wow... that's just crazy! I wonder if it's possible to get any shorter with ES6...

@ETHproductions yes it is! I have an 86 ready, but I'm still trying to do something better (my - moving - target is Neil with 85 ... no damn 83)

How does the output using eval work?

@EnderShadow8 eval returns the last expression evaluated that in this case is o in both the branches of the ternary operator

Batch, 192 bytes
@set s=a1 a3 a5 a7
@set t=b2 b4 b6 b8
@if not %1==light call:b
@set s=a2 a4 a6 a8
@set t=b1 b3 b5 b7
@if %1==dark exit/b
:b
@echo %s% %s:a=c% %s:a=e% %s:a=g% %t% %t:b=d% %t:b=f% %t:b=h%

Python 2, 73 71 70 bytes
lambda s:[chr(x/8+97)+`x%8+1`for x in range(64)if x+x/8&1^ord(s[0])%3]

I'm still a bit confused whether functions are okay for the question, since the challenge mentions a "separator", but since there's a lot of other function submissions I've done the same.
Similar to Erwan's answer but with a lot bit more Python 2-ness.
(-2 bytes thanks to @xnor)

lol I don't even test between s=="dark" and  s[0]=="d" but for my defence in my really first try i used s,*_=s and 4 cmp

I feel like there should be something shorter like ord(s[_])&_ or ord(s[_])/_.

@xnor Indeed, there is with % :) Thanks!

Pyth, 48 39 bytes
K*<G8S8Jfq%xGhT2%seT2K?qhz\bK?qhz\lJ-KJ

Try it here!
Still longer than the other Pyth solution, but I don't think I can beat this with my algorithm.
Explanation
First we generate a list of all squares on the board and assign it to Y. Then we filter this list so that only light squares remain and assign this list to J. After that we evaluate the input and print:

Y if input was both
J if input was light
Y-J if the input was dark

Determining if a square is light works as follows:

Map the char to a number from 1-8 (a->1, b->2), results in 18 for a8, etc.
check if both those numbers are odd or even (x%2 == y%2)
If they are, the square is light, otherwise its dark

K*&ltG8S8Jfq%xGhT2%seT2K?qhz\bK?qhz\lJ-KJ  # z=input

 *                                         # Cartesian product of
  &ltG8                                      # first 8 letters of the alphabet (a-h)
     S8                                    # 1-indexed range (1-8)
K                                          # K holds now all squares
       f             K                     # Filter K
        q                                  # is equal
         %xGhT2                            # map [a-h] to a number [1-8] and take it modulo 2
               %seT2                       # Take modulo 2 from the row number
                      ?qhz\bK              # If input starts with 'b' print K
                             ?qhz\lJ       # If it starts with 'l' print J
                                    -KJ    # Otherwise print the difference of those 2

Oh geez that's shorter than mine by a long shot.

PHP, 132 126 120 108 106 bytes
for($s=strtr($argv[1],bdl,210);$c<8;$c++)for($r=0;$r<8;)if((++$r+$c)%2==$s||$s>1)echo"abcdefgh"[$c]."$r ";

It loops through the cols (0-7) and rows (1-8) and checks if the sum of both is odd/even.
Tested with PHP 5.6.4, run it: php -d error_reporting=30709 -r '' {dark|light|both}

Welcome to PPCG! This is a good answer, but you'll get more votes if you add an explanation.

I think you can replace$s==2 with $s-1. If $s=2, and -1, it's 1, which is truthy and will continiue

And I think $c=0 can be $c, it'll give a bunch of notices, but at least for dark it works fine

Thank you, Martijn! I forgot to remove the braces too, -6 bytes for now. And I don't know why, but $s-1 doesn't work, but it should. Thanks for this great idea! I'll debug that later.

I'm new to this site, but error messages because of undefined $c variable? That sounds a bit strange and invalid. Or not?

Nope that's perfectly valid. It's only a notice, not really an error, as it will interpret the unset variable as a null. You can mute the error messages with php -d error_reporting=30709. Also, here are some tips for PHP golfs. I only do PHP answers, so you might have a look at my answers for some inspiration as well.

You can also drop the incrementer in the $r loop and move it to the first or last use of $r.  Just test the polarity on it.

Also, I don't know PHP, but maybe you can not declare $i and just move it inline where you use it?

Inline $i works, great idea! $r incrementer moved. $c definition removed. -12 bytes – woohoo! :-)

@Martijn $s-1 does not work, because "light" evaluates as 0 - 1 = -1 and that is true too!

Here you go: for($s=strtr($s[0],bdl,210);$c<8;$c++)for($r=0;$r<8;)if((++$r+$c)%2==$s||$s>1)echo'abcdefgh'[$c],"$r "; (103 bytes). The replacements are easy to find.

By the way, how are you taking input? This is neither a full program nor a function, and register globals was removed in PHP 5.4.

you shouldn't set error_reporting to 0, because that also hides fatal errors. 30709 just hides notices, warnings and strict

Better now? It takes the first CLI argument. Thx Ismael and Aross for your input!

Looks much better, +1. I challenge you to improve upon my score though :)

btw @aross: Why print instead of echo? It's one extra byte. (I post it here because I don't have 50 reputation to comment on your solution, which is a  brilliant and short implementation!)

echo is a language construct and cannot be used in such a context, whereas print can.

Oh indeed. Stupid me…

PHP, 99 82 79 76 74 73 bytes
Uses ISO 8859-1 encoding.
for($z=$argv[1];++$x<72;)$x%9&&$z<c|$z>k^$x&1&&print~ß.chr($x/9+97).$x%9;

Run like this (-d added for aesthetics only):
php -d error_reporting=30709 -r 'for($z=$argv[1];++$x<72;)$x%9&&$z<c|$z>k^$x&1&&print~ß.chr($x/9+97).$x%9; echo"\n";' dark

It works like this: variable $x is incremented from 1 to 71, the numbers correspond to the cells as shown below.
r\c 1  2  3  4  5  6  7  8  [invalid column]
A   1  2  3  4  5  6  7  8  9
B  10 11 12 13 14 15 16 17 18
C  19 20 21 22 23 24 25 26 27
D  28 29 30 31 32 33 34 35 36
E  37 38 39 40 41 42 43 44 45
F  46 47 48 49 50 51 52 53 54
G  55 56 57 58 59 60 61 62 63
H  64 65 66 67 68 69 70 71 72

Therefore, $x modulo 9 yields the column number and $x / 9 yields the row number, which I convert to a letter using chr. The code $z<c|$z>k^$x&1 yields true for input both ($z<c) and in the case of light or dark only for the even or odd cells respectively ($z>k ^ $x&1). The result of this expression determines whether or not the cell coordinates will then be printed. Finally, if $x modulo 9 results in 0, I skip that non-existant cell.

Saved 18 17 bytes (fixed a bug) by having only 1 loop, converting the number to a char instead of the other way around
Saved 3 bytes by combining the condition for dark and light with a xor
Saved 3 bytes by comparing against the full input instead of the first char
Saved 2 bytes because no longer need to subtract .125 in the expression $x/9+69.9 to get the correct row number before converting to a char
Saved a byte by using ~ß to yield a space

Perl, 69 + 3 = 72 bytes
$b=/b/;$i=/l/;$_="@{[grep{$i=!$i||$b}map{$l=$_;map{$l.$_}1..8}a..h]}"

To be run with perl -p, for which I've added 3 bytes.
Less-golfed version (slightly different, as the babycart operator makes it hard to format nicely):
$b=/b/;                       # flag for input containing b
$i=/l/;                       # start $i as true if input contains 'l'

@a = grep {
    $i = !$i||$b                # alternate unless $b is true
} map {
    $l = $_;                    # save letter
    map {
        $l.$_                   # join letter and number
    } 1..8                      # generate number sequence
} a..h;                         # generate letter sequence

# golfed version uses babycart operator around array expr to save one byte
$_ = "@a"                       # write array, separated

The golfed version uses "@{[]}"; the commented version uses @a=...; "@" so that the commented code is still runnable.

map$l.$_,1..8 -1

and the same trick for grep: grep$i=!$i||$b,map again -1

Java, 143
class H{public static void main(String[]a){for(char
c=96;++c<'i';)for(int
i=0;++i<9;)if((i+c)%2!=a[0].charAt(0)%3)System.out.println(c+""+i);}}

Hey, it's not the longest answer :)
Input is taken as a command-line argument.

Vitsy, 90 82 bytes
'`'8\[1+8\:]Yy1-\?8\['1'v8\[vD1+vr?]vX]i'h'-)[88*\[Z?aO]]i'r'-)[?1m]1m
84*\[Z??aO]
Explanation of the first line:
'`'8\[1+8\:]Yy1-\?8\['1'v8\[vD1+vr?]vX]i'h'-)[88*\[Z?aO]]i'r'-)[?1m]i'g'-)[1m]
'`'                     Push ` to the stack. (this is 1 less than a in ASCII)
   8\[     ]            Do the stuff in brackets 8 times.
      1+                Add one on every recursion (this gets a, b, c, d...)
        8\:             Clone the stack 8 times. (This gets 8 of each a, b, c...)
Y                       Remove the current stack.
 y1-\?                  Go one stack to the left (I really need to builtin this)
8\[                 ]   Do the stuff in brackets 8 times.
   '1'                  Push character literal 1 to the stack.
      v                 Save it as a temporary variable.
       8\[       ]      Do the stuff in brackets 8 times.
          v             Push the temporary variable to the stack.
           D            Duplicate the top item of the stack.
            1+          Add one to it (this gives us 1, 2, 3, 4...)
              v         Capture the top item of the stack as a temporary variable.
               r        Reverse the stack.
                ?       Go a stack to the right.
                  vX    Clear the temporary variable slot.
i'h')[          ]       If the last character of the input is 'h', do the stuff in brackets
      88*\[    ]        Do the stuff in brackets 64 times.
           Z            Output everything in the stack as a character.
            ?           Rotate right a stack.
             aO         Output a newline.
i'r')[?1m]              If the penultimate character of the input is 'r', rotate over a
                        stack, then execute the first index of lines of code.
1m                      Execute the first index of lines of code.
Explanation of the second line:
84*\[Z??aO]
84*\[     ]   Do the stuff in brackets 32 times.
     Z        Output everything in the stack as a char.
      ??      Rotate two stacks over.
        aO    Output a newline.
There will be bonus trailing newlines for 'dark' and 'both'. Requires that only 'dark', 'both', or 'light' will be input.
Try it online!

PowerShell v3+, 142 129 bytes
param($a)$d=$a[0]-in('d','b');$l=$a[0]-in('l','b')
97..104|%{$i=[char]$_;1..8|%{if((($q=($_+$i)%2)-eq$l)-or($q+1-eq$d)){"$i$_"}}}

Takes input $a and sets two variables for if we're to output $dark or $light squares based on the first letter of the input.
Then, we loop over a-h and 1-8 and uses the same trick as on Determine the color of a chess square to parse whether it's a light or dark square (setting helper variable $q in the first test) and add that square to the pipeline if appropriate. After execution, the elements on the pipeline are output one per line.
Requires v3 or newer for the -in operator.
Edit - Saved 13 bytes by eliminating the switch and by changing equality testing order

Jolf, 48 bytes
Ζ-ώ~1tΜ fΜZAQ8ΨΖ+ζ|<%ζγwώt8ώ6d|i'ldbHγ

It's all greek to me ¯\_(ツ)_/¯ This is a transpiling of edc65's excellent answer.
Ζ-ώ~1t
Ζ        set ζ to
  ώ~1     100 * 2
 -   t    minus 10 (=190)

ΜZAQ8ΨΖ+ζ|<%ζγwώt8+2t
 ZAQ8                 A zero array of length Q8 (8*8 = 64)
Μ    Ψ                map that
      Ζ+ζ             ζ +=
           %ζγwώt       ζ % (γ = 19)
          <      8      < 8
         |        ώ6  || 12

Μ f■above thing■d|i'ldbHγ
 _f■above thing■d                    filter the above thing
                 |i'l      removing all the bad stuff (i<'d'|v%2^i>'l')
Μ                              dbHγ  map each character to base 19

C++, 132 bytes
Takes input by command-line. Uses pointer/modulo voodoo for print condition.
#include<stdio.h>
int main(int i,char**v){for(int n=0;n<64;n++)if((n+(i=n/8))%2-*v[1]%3){putchar(i+97);putchar(n%8+49);putchar(32);}}

I don't think the n-loop is necessary. I think nested for loops for i and j would trim a few bytes off. The (i+j)%2 approach is really clever. I hadn't thought of that.

I just notice that (i//8+i%8)%2 is the same as (i//8+i)%2 so you can win some bytes if you remove the definition of j=n%8

Haskell, 133 116 105 100 98 91 bytes
f r=[["abcdefgh"!!x,"12345678"!!y]|x<-l,y<-l,odd(x+y)||r<"l",even(x+y)||r!!0/='d']
l=[0..7]

This is my first attempt at golfing Haskell.
With some help from Michael Klein, we managed to get it under 100 chars!

How about c>0 for c==1 and c<1 for c==0? Saves two bytes.

Fantastic, we got it under 100! Thank you Michael.

You're welcome. I got a bit sucked in and got it down to 86 bytes by refactoring a bit: f r=[[[a,b]|a<-['a'..'h'],b<-['1'..'8']]!!i|i<-[0..63],even i||r<"l",odd i||r!!0/='d']

That's very nice, a rethought approach. Although I'm sorry to say that odd and even i do not give us diagonal stripes. Some solve this with i+i\div`8(likex+y). Others start with ['1'..'9']and[0..71]and then retain only thei`mod`9<8results later, for 96 bytes. However, this hybrid of our two approaches does well at 91 bytes:l=[0..7];f r=[["abcdefgh"!!x,"12345678"!!y]|x<-l,y<-l,odd(x+y)||r<"l",even(x+y)||r!!0/='d']`

Ah, well that's still a good bit better

CJam, 29
qci3%:X;8Ym*{~+2%X-},"a1 "f.+

Just a quick and dirty solution :p
Try it online
Explanation:
q           read the input
ci          convert to (first) character then to integer
3%          modulo 3; results for d(ark), l(ight) and b(oth) are 1, 0, 2
:X;         store in X and pop
8Ym*        generate all pairs (Y=2) of numbers from 0 to 7
{…},        filter using the condition block
  ~         dump the current pair on the stack
  +2%       calculate the sum modulo 2
  X-        subtract X; if the result is not 0, the pair is kept
"a1 "f.+    vectorized-add "a1 " to each remaining pair
             this means the character 'a' is added to the first number,
             the character '1' is added to the second number,
             and then the space character is appended
            the contents of the stack are automatically printed at the end

JavaScript ES6, 187 160 159 bytes
I'm probably missing something painfully obvious. Oh well. Not having to flatten the array helps.
l=s=>(E=[2,4,6,8],O=[1,3,5,7],h=(z=s[0]=="d")?O:E,d=z?E:O,[...h.map(t=>[..."aceg"].map(e=>e+t)),...(d.map(t=>[..."bdfh"].map(e=>e+t))),...(s[0]=="b"?l`d`:[])])

Returns a 2D array.

Try it here:

l=s=>(E=[2,4,6,8],O=[1,3,5,7],h=(z=s[0]=="d")?O:E,d=z?E:O,[...h.map(t=>[..."aceg"].map(e=>e+t)),...(d.map(t=>[..."bdfh"].map(e=>e+t))),...(s[0]=="b"?l`d`:[])])

U=x=>o.innerHTML=JSON.stringify(l(i.value));
i.onchange=U;U();
*{font-family:Consolas,monospace;}
<select id=i><option value="light">light</option><option value="dark">dark</option><option value="both">both</option></select>

Rust, 263 259 244 Bytes
use std::char;use std::env;fn main(){let n=env::args().nth(1).unwrap();for i in 0..8{for j in 0..8{if n=="both"||(n=="dark"&&(i+j)%2==0)||(n== "light"&&(i+j)%2!=0){println!("{}{}",char::from_u32(i+97).unwrap(),char::from_u32(j+49).unwrap())}}}}

Expanded Form:
fn main() {
    let input = env::args().nth(1).unwrap();
    for i in 0..8{
            for j in 0..8{
                if input == "both"
                || (input == "dark" && (i+j)%2==0)
                || (input == "light" && (i+j)%2!=0){
                    println!("{}{}",char::from_u32(i+97).unwrap(),char::from_u32(j+49).unwrap());
            }
        }
    }
}

Rather than hard-coding your input, is it not possible to read it from the terminal or the command line or as a function parameter?

R, 129 94 bytes
I knew I could generate the board better :). Essentially this builds an inverted board, filtering out grid references where the shade does not match the input.  Output is space separated.
a=which(array(c('light','dark'),c(9,9))[-9,-9]!=scan(,''),T);cat(paste0(letters[a[,1]],a[,2]))

Ungolfed
a=which(                           # Get the indexes of
  array(c('light','dark'),c(9,9))  # an array of light dark
    [-9,-9]                        # except for the ninth row and column
      !=scan(,'')                  # where the value doesn't equal the input
    ,T                             # return array index not vector
  );
cat(paste0(letters[a[,1]],a[,2]))  # using letters for col

Test
> a=which(array(c('light','dark'),c(9,9))[-9,-9]!=scan(,''),T);cat(paste0(letters[a[,1]],a[,2]))
1: dark
2:
Read 1 item
a1 c1 e1 g1 b2 d2 f2 h2 a3 c3 e3 g3 b4 d4 f4 h4 a5 c5 e5 g5 b6 d6 f6 h6 a7 c7 e7 g7 b8 d8 f8 h8
> a=which(array(c('light','dark'),c(9,9))[-9,-9]!=scan(,''),T);cat(paste0(letters[a[,1]],a[,2]))
1: light
2:
Read 1 item
b1 d1 f1 h1 a2 c2 e2 g2 b3 d3 f3 h3 a4 c4 e4 g4 b5 d5 f5 h5 a6 c6 e6 g6 b7 d7 f7 h7 a8 c8 e8 g8
> a=which(array(c('light','dark'),c(9,9))[-9,-9]!=scan(,''),T);cat(paste0(letters[a[,1]],a[,2]))
1: both
2:
Read 1 item
a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 c2 d2 e2 f2 g2 h2 a3 b3 c3 d3 e3 f3 g3 h3 a4 b4 c4 d4 e4 f4 g4 h4 a5 b5 c5 d5 e5 f5 g5 h5 a6 b6 c6 d6 e6 f6 g6 h6 a7 b7 c7 d7 e7 f7 g7 h7 a8 b8 c8 d8 e8 f8 g8 h8
>

Oracle SQL 11.2, 192 180 bytes
SELECT CHR(64+x),DECODE(y,0,8,y)FROM(SELECT CEIL(LEVEL/8)x,MOD(LEVEL,8)y FROM DUAL CONNECT BY LEVEL<=64)WHERE(:1='dark'AND MOD(x+y,2)=0)OR(:1='light'AND MOD(x+y,2)=1)OR(:1='both');

Un-golfed
WITH v AS
(
  SELECT CEIL(LEVEL/8)x, DECODE(MOD(LEVEL,8),0,8,MOD(LEVEL,8))y
  FROM DUAL CONNECT BY LEVEL<=64
)
SELECT CHR(64+x),y
FROM   v
WHERE  (:1='dark' AND MOD(x+y,2)=0)OR(:1='light' AND MOD(x+y,2)=1)OR(:1='both');

The v view generate the coordinates of each square. If the sum of the coordinates is even then the square is black, else it's white.

MATL, 31 bytes
1)t3\8:t!++w4\~?H\]2#f2Y2!w)wVh

Try it online!

This one doesn't seem to give the correct squares. "dark" is giving x1,x3,x5,x7 for every letter x, but that corresponds to 4 columns, not the black squares.

@Esteemator Sorry, my mistake. Corrected

Ruby, 85
I think there are shorter ways about this, but this is a cute use of .upto.
gets;'a1'.upto('h8'){|e|puts e if e[/[1-8]/]&&(~/b/||((e.ord%2!=e[1].ord%2)^! ~/l/))}

JS, 197 bytes
b=[];d=[];l=[];for(i=1;i<9;i++){for(j=1;j<9;j++){a=String.fromCharCode(96+i*1)+j;b.push(a);if((i+j)%2<1){d.push(a)}else{l.push(a)}}}m=[0,"both",b,"dark",d,"light",l];alert(m[m.indexOf(prompt())+1])

Python (3.5), 106 100 96 92 bytes
use the trick of MegaTom (i+j)%2 to win 6 bytes
f=lambda s:[chr(97+i//8)+str(1+i%8)for i in range(64)if s[0]=='b'or(i//8+i)%2==(s[0]=='l')]

Try it on repl.it
Results
>>> f('light')
['a2', 'a4', 'a6', 'a8', 'b1', 'b3', 'b5', 'b7', 'c2', 'c4', 'c6', 'c8', 'd1', 'd3', 'd5', 'd7', 'e2', 'e4', 'e6', 'e8', 'f1', 'f3', 'f5', 'f7', 'g2', 'g4', 'g6', 'g8', 'h1', 'h3', 'h5', 'h7']
>>> f('dark')
['a1', 'a3', 'a5', 'a7', 'b2', 'b4', 'b6', 'b8', 'c1', 'c3', 'c5', 'c7', 'd2', 'd4', 'd6', 'd8', 'e1', 'e3', 'e5', 'e7', 'f2', 'f4', 'f6', 'f8', 'g1', 'g3', 'g5', 'g7', 'h2', 'h4', 'h6', 'h8']
>>> f('both')
['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'g1', 'g2', 'g3', 'g4', 'g5', 'g6', 'g7', 'g8', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7', 'h8']

Previous version
f=lambda s:[i for i in[i+j for i in'abcdefgh'for j in'123456780'][s[0]=='l'::2-(s[0]=='b')]if'0'not in i]

C++, 119 Bytes
Based on MegaTom's trick.
#include <stdio.h>
int main(int n,char**v){for(n=0;n<64;++n){if((n+n/8)%2-**(v+1)%3){printf("%c%c ",n/8+97,n%8+49);}}}

Mathematica 133 bytes
Method 1: 108 bytes. This constructs the board as a table, with labels in each cell, and returns light or dark diagonals or bands as required.
Table[Table[{i,j},{i,{h,g,f,e,d,c,b,a}},{j,Range@8}]~Diagonal~k,{k,If[#=="light",-6,-7],7,If[#=="both",1,2]}]&

%["light"]   (*where % repeats the preceding line *)

{{{b, 1}, {a, 2}}, {{d, 1}, {c, 2}, {b, 3}, {a, 4}}, {{f, 1}, {e,
     2}, {d, 3}, {c, 4}, {b, 5}, {a, 6}}, {{h, 1}, {g, 2}, {f, 3}, {e,
     4}, {d, 5}, {c, 6}, {b, 7}, {a, 8}}, {{h, 3}, {g, 4}, {f, 5}, {e,
     6}, {d, 7}, {c, 8}}, {{h, 5}, {g, 6}, {f, 7}, {e, 8}}, {{h, 7}, {g,
      8}}}

Method 2: 133 bytes. Creates an array and selects according to the even-odd nature of the sum of the row number + column number of each cell.
Position[Array[Boole@OddQ[#+#2] &,{8,8}],Switch[#,"dark",0,"light",1,"both",0|1]]/.
{j_,k_}:>{j/.Thread[Range@8->{a,b,c,d,e,f,g,h}],k}&

C (gcc), 112 bytes
f(char*s){for(int m=*s^'d'?*s^'l'?3:2:1,l=64,x;l--;m&1&!x|(m&2&&x)&&printf("%c%d ",l%8+97,l/8+1))x=l%8%2^l/8%2;}

Try it online!
If a == 1, then a square will always be black if the "oddness" of row and column is the same, i.e. both are odd or both are even. The opposite is true for white squares, where row and column will always differ in oddness.
After that, it's just a matter of combining row and column loops, as well as consulting a table of operator precedence until a sufficient level of incomprehensibility has been reached.


text:
Transpose quine
In this quine variant, your program must output its source code transposed across the diagonal from the top left to the bottom right. For example:

your program
on
four lines

outputs
 yof
 ono
 u u
 r r

 p l
 r i
 o n
 g e
 r s
 a
 m

The whitespace in the output is not arbitrary. Spaces appear in two situations: where there is a space in the original (e.g. between r and l in the fourth column) and where it's necessary to pad characters (e.g. all the spaces in the first column.) Both are required, and spaces cannot appear anywhere else in the output.
A single trailing newline in the output can optionally be ignored. Trailing newlines in the source code have no effect on the output, and leading newlines in the source code must be handled as in the example above. Assume that every character that is not a newline is one column wide and one row tall, even though for characters like tab this may lead to an ugly output.
Your solution must have at least two lines with at least two non-newline characters each, and must not be its own transpose (the output cannot be identical to the source.)
Cheating quines that read from the file that contains their source code, pull data from a URL, use quining built-ins, and so on are not permitted.
This is code golf: shortest code in bytes wins.

Does this need to be a true quine?

@ThomasKwa As opposed to?

@MartinBüttner Maybe there's a language where literals are echoed transposed. Just in case.

@ThomasKwa That's fine as long as it follows all the rules specified.

Is the use of external libraries (such as Lodash in Javascript) prohibited?

My gut says it's okay as long as you include the necessary code or flags to import the library in your solution, which I think means you'd have to change your Lodash answer a bit.

CJam, 14 bytes
{`"_~".+N*}
_~

Test it here.
While shorter, probably a bit less interesting than the Fission solution.
Explanation
{       e# Quine framework. Runs the block while another copy of it is on the stack.
  `     e# Stringify the block.
  "_~"  e# Push the remaining code as a string.
  .+    e# Element-wise append... essentially puts the two strings in a grid and
        e# transposes it.
  N*    e# Join with linefeeds.
}_~

Fission, 17 bytes
Still my favourite language for quines...
'"
!0
0+
;!
DN
"!

Try it online!
Explanation
This quite similar to the basic Fission quine. In fact, if it wasn't for the "must have at least two lines with at least two non-newline characters each" rule, I simply could have transposed that and replace R with D. That rule makes things a bit more interesting though, because we need to print another line.
Control flow starts at the D with a single atom going south. Since it hits the " it will wrap around and print
'!0;D

to STDOUT, similar to how it would in the normal quine. '! then sets the atom's mass to the character code of !. The 0 is a teleporter which transports the atom to the second column, where it's still moving south.
With + we increment the atom's mass to the value of ". !N! the prints quote, linefeed, quote. STDOUT now looks like this:
'!0;D"
"

After wrapping around, the atom hits another " and now prints the second line verbatim:
'!0;D"
"0+!N!

We're done now. The atom uses the teleporter once again, and lands in the ; which destroys it and thereby terminates the program.
I suppose the neatest bit here is putting one " at the bottom and the other at the top so that I can print them in one go without having to set the value of ! once more (because it would get overwritten by entering string mode again).

Javascript ES6, 90 bytes
$=_=>[...(_=`$=${$};$()`.split`
`)[0]].map((x,y)=>_.map(v=>[...
v][y]).join``).join`
`;$()

Not bad, not bad.
Explanation
Here's the standard quine framework:
$=_=>`$=${$};$()`;$()

To modify, I just split the quine string along newlines and chars to create a matrix of chars, transposed using 2 map functions, and joined to create the output.

Stax, 23 bytes
"34bL:f2MMm
"34bL:f2MMm

Try it online!
Adaptation of the "34bL"34bL quine, which is based on an idea used in quines in many languages.

Befunge-93, 57 bytes
^
_^
,@
+,
5*
52
,+
*9
28
+|
9
8#
|!
 ,
##
!:
,^
#
:
^
""

This works by putting each character in the first column on the stack (except the quote itself), then printing each item off of the stack.  After that, it prints the quote, prints a newline, and then moves over to the second column.  It does the same thing sans print a newline.
You can test it in the link in the title, but you'll need to copy-paste the code into the window yourself.  If you hit the 'slow' button, it will show you the path the pointer takes and the stack at the time.

Could it be shorter to move the quote in the second column to the top like I did in my Fission answer?

I can move the quote to the top and rearrange the second column and have it still work, but it ends up still being 57 bytes since the first column still has to be the same height

Hm okay, I figured it might allow you to generate the " only once, so that you could shift some code from the first column to the second.

Python 2, 91 75 69 bytes
s='#%r;print"s#\\n="+"\\n".join(s%%s)';print"s#\n="+"\n".join(s%s)
##

Try it online
Explanation:
This uses a modification of the standard quine:
s='s=%r;print s%%s';print s%s

After modification:
s='s=%r;print"\\n".join(s%%s)';print"\n".join(s%s)

This would be enough if a single line was allowed. Then, I added two characters to the 2nd line to fulfill that requirement. The # chars on the second line can be replaced with anything, so long as you change them in the first line, too, and it makes the program syntactically valid.
To print it correctly now, I have to print # at the end of the first two lines. So I remove the first two characters from the string s, and print those with # before printing s%s. I put one of the # at the start of s to save some bytes by removing a newline literal.


text:
Find the missing number in an undelimited string
The challenge is to identify the missing number in a string of undelimited integers.
You are given a string of digits (valid input will match the regular expression ^[1-9][0-9]+$).  The string represents a sequence of integers.  For example, 1234567891011.  All numbers in the sequence are in the range from 1 and 2147483647 inclusive.
The sequence is a series of numbers where each number is one greater than its predecessor.  However, this sequence may contain one and only one missing number from the sequence.  It is possible that a given string also contains no missing numbers from the sequence.  The string will always contain at least two numbers from the sequence.
The code must output or return the missing value, or 0 (this is a 0 - not a falsy value) in the event that the no missing values were found.
The following are valid inputs and their output/return:
input                         output    actual sequence (for refrence)
123467                        5         1 2 3 4 _ 6 7
911                           10        9 __ 11
123125126                     124       123 ___ 125 126
8632456863245786324598632460  8632458   8632456 8632457 _______ 8632459 8632460
123                           0         1 2 3
8632456863245786324588632459  0         8632456 8632457 8632458 8632459

While all of this is described as a 'string' as input, if the language is capable of handling arbitrarily large numbers (dc and mathematica, I'm looking at you two) the input may be an arbitrarily large number instead of a string if that makes the code easier.
For reference, this was inspired by the Programmers.SE question: Find missing number in sequence in string

Are you sure this is unambiguous?

@MartinBüttner I've thought a bit about it and haven't been able to come up with a situation where a sequence increasing by 1 (that might be the problem) has an ambiguous situation.

Is there an entry in OEIS for the list of integers that are a concatenated sequence missing exactly one element?

@mbomb007 I don't think so as there are infinitely many different lists.  And that this is just one big ole string. Not sure how you'd define it.  For that matter, an interesting CS question would be "what is the language that accepts all these strings".  Its certainly not regular. I doubt its CF.

They would be sorted, of course. A032607 is similar, but is only a subset of the sequence I'm suggesting.

The sequence would be: 13,24,35,46,57,68,79,124,134,235,245,...,679,689,1012,1113,1214,1235,...

@mbomb007 ahh.  Ok, I understand that now. That's a rather interesting sequence. I was looking at the 689 to 1012 gap and wondering if there was anything there and then realized, no, there isn't.

Actually, you're right. I forgot 810 and 911. Thanks.

I made the sequence the subject of a challenge: http://codegolf.stackexchange.com/q/73513/34718

Haskell, 115 112 bytes
g b|a<-[b!!0..last b]=last$0:[c|c<-a,b==filter(/=c)a]
maximum.map(g.map read.words.concat).mapM(\c->[[c],c:" "])

The first line is a helper function definition, the second is the main anonymous function.
Verify test cases (I had to run shorter tests because of time restrictions).
Explanation
This is a brute force solution: split the string into words in all possible ways, parse the words to integers, see whether it's a range with one element missing (returning that element, and 0 otherwise), and take the maximum over all splittings.
The range-with-missing-element check is done in the helper function g, which takes a list b and returns the sole element in the range [head of b..last of b] that's not in b, or 0 if one doesn't exist.
g b|                         -- Define g b
    a<-[b!!0..last b]=       -- (with a as the range [head of b..last of b]) as:
    last$0:[...]             --  the last element of this list, or 0 if it's empty:
            c|c<-a,          --   those elements c of a for which
            b==filter(/=c)a  --   removing c from a results in b.
mapM(\c->[[c],c:" "])        -- Main function: Replace each char c in input with "c" or "c "
map(...)                     -- For each resulting list of strings:
  g.map read.words.concat    --  concatenate, split at spaces, parse to list of ints, apply g
maximum                      -- Maximum of results (the missing element, if exists)

JavaScript (ES6), 117 bytes
s=>eval(`for(i=l=0;s[i];)for(n=s.slice(x=i=m=0,++l);s[i]&&!x|!m;x=s.slice(x?i:i+=(n+"").length).search(++n))m=x?n:m`)

Explanation
Fairly efficient approach. Finishes instantly for all test cases.
Gets each substring from the beginning of the input string as a number n and initialises the missing number m to 0. It then repeatedly removes n from the start of the string, increments n and searches the string for it. If index of n != 0, it checks m. If m == 0, set m = n and continue, if not, there are multiple missing numbers so stop checking from this substring. This process continues until the entire string has been removed.

var solution =

s=>
  eval(`                     // use eval to use for loops without writing {} or return
    for(
      i=                     // i = index of next substring the check
      l=0;                   // l = length of initial substring n
      s[i];                  // if it completed successfully i would equal s.length
    )
      for(
        n=s.slice(           // n = current number to search for, initialise to subtring l
          x=                 // x = index of n relative to the end of the previous n
          i=                 // set i to the beginning of the string
          m=0,               // m = missing number, initialise to 0
          ++l                // increment initial substring length
        );
        s[i]&&               // stop if we have successfully reached the end of the string
        !x|!m;               // stop if there are multiple missing numbers
        x=                   // get index of ++n
          s.slice(           // search a substring that starts from the end of the previous
                             //     number so that we avoid matching numbers before here
            x?i:             // if the previous n was missing, don't increment i
            i+=(n+"").length // move i to the end of the previous number
          )
          .search(++n)       // increment n and search the substring for it's index
      )
        m=x?n:m              // if the previous number was missing, set m to it
  `)                         // implicit: return m
<input type="text" id="input" value="8632456863245786324598632460" />
<button onclick="result.textContent=solution(input.value)">Go</button>

JavaScript (ES6) 114
s=>eval("for(d=0,n=-9,z=s;z=z.slice((n+'').length);z.search(++n)?z.search(++n)?n=(z=s).slice(x=0,++d):x=n-1:0);x")

Less golfed and explained
f=s=>{
  d = 0  // initial digit number, will be increased to 1 at first loop
  n = -9 // initial value, can not be found
  z = s  // initializa z to the whole input string
  // at each iteration, remove the first chars of z that are 'n'
  // 'd' instead of 'length' would be shorter, but the length can change passing from 9 to 10
  for(; z=z.slice((n+'').length); )
  {
    ++n; // n is the next number expected in sequence
    if (z.search(n) != 0)
    {
      // number not found at position 0
      // this could be the hole
      // try to find the next number
      ++n;
      if (z.search(n) != 0)
      {
        // nope, this is not the correct sequence, start again
        z = s; // start to look at the whole string again
        x = 0; // maybe I had a candidate result in xm but now must forget it
        ++d;   // try a sequence starting with a number with 1 more digit
        n = z.slice(0,d) // first number of sequence
      }
      else
      {
        // I found a hole, store a result in x but check the rest of the string
        x = n-1
      }
    }
  }
  return x // if no hole found x is 0
}

Test

F=s=>eval("for(d=0,n=-9,z=s;z=z.slice((n+'').length);z.search(++n)?z.search(++n)?n=(z=s).slice(x=0,++d):x=n-1:0);x")

console.log=x=>O.textContent+=x+'\n'

elab=x=>console.log(x+' -> '+F(x))

function test(){ elab(I.value) }

;['123467','911','123125126','8632456863245786324598632460',
  '123','124125127','8632456863245786324588632459']
.forEach(t=>elab(t))
<input id=I><button  onclick='test()'>Try your sequence</button>

C, 183 168 166 163 bytes
n,l,c,d,b[9];main(s,v,p)char**v,*p;{for(;s>1;)for(d=s=0,n=atoi(strncpy(b,p=v[1],++l)),p+=l;*p&&s<2;)p+=memcmp(p,b,c=sprintf(b,"%d",++n))?d=n,s++:c;printf("%d",d);}

Ungolfed
n,l,c,d,b[9];

main(s,v,p)char**v,*p;
{
    /* Start at length 1, counting upwards, while we haven't
       found a proper number of missing numbers (0 or 1) */
    for(;s>1;)
        /* Start at the beginning of the string, convert the
           first l chars to an integer... */
        for(d=s=0,n=atoi(strncpy(b,p=v[1],++l)),p+=l;*p&&s<2;)
            /* If the next number is missing, then skip, otherwise
               move forward in the string.... */
            p+=memcmp(p,b,c=sprintf(b,"%d",++n))?d=n,s++:c;

    printf("%d",d); /* print the missing number */
}

How does this work for inputs like 891112 where the numbers have different lengths?

@Zgarb It works just fine. The sprintf call returns the length of the missing number, regardless if it's longer than the previous or not.

Ok, thanks! Have a +1.

Jelly, 16 bytes
ŒṖḌI’ḂƑƊƇḢ.ịr/ḟƲ

Try it online!
Input as a list of digits. Outputs a singleton list [a] containing the missing element, or [] if there isn't one. +1 byte to output 0 instead, and +1 byte to input as a single integer.
How it works
ŒṖḌI’ḂƑƊƇḢ.ịr/ḟƲ - Main link. Takes a list of digits D on the left
ŒṖ               - All partitions of D
  Ḍ              - Convert back to integers
       ƊƇ        - Keep those for which the following is true:
   I             -   Forward differences
    ’            -   Decrement
     ḂƑ          -   This list is invariant under bit i.e. all 1 or 0
         Ḣ       - Take the first, R
               Ʋ - Over R:
          .ị     -   Take the first and last elements
            r/   -   Yield a range between them
              ḟ  -   Remove the elements that are in R
                   This returns the single element that is in the range but not R


text:
Convert a "mixed-base" string to ASCII
Given an input of a string with bytes that may be in either binary, octal, or
hex, output the string's ASCII equivalent.
Input will be provided in the following format, for example:
501200100001147

which represents
0x50 0o120 0b01000011 0x47

which is equivalent (in ASCII) to
PPCG

Binary, octal, and hex will always be provided with 8, 3, and 2 digits
respectively.
For the purposes of this challenge, only printable ASCII must be supported.
This is the range 32..126 inclusive. Therefore, it is impossible for there to
be ambiguity. Note that

A string represents binary if and only if it starts with a 0 and its second
character is either a 0 or a 1. All printable ASCII characters have their
high bit off in binary (i.e. start with a 0), and none of them start with
00 or 01 in either hex or octal.
With binary out of the way, note that all printable ASCII characters start
with 2-7 in hex and 0-1 in octal. Therefore, it is possible to
unambiguously distinguish between hex and octal as well.

You may assume that hex input is provided as either lowercase or uppercase,
whichever is more convenient.
Regex makes the parsing portion of the challenge semi-trivial. I don't want to ban the use of regex outright, but if you have a non-regex solution longer than its regex-using counterpart, feel free to post it along with the "real" answer anyway, since I'd be interested to see it as well. :)
Since this is code-golf, the shortest code in bytes will win.
Test cases:
In                   Out
-----------------------------------
501200100001147    | PPCG
5C01101111100      | \o@
313206306400110101 | 12345
2A200530402C       | * + ,
0011111100111111   | ??
<empty string>     | <empty string>

Lex + C, 156 124 bytes
%{
p(b){putchar(strtol(yytext,0,b));}
%}
%option noyywrap
%%
0[01]{7} {p(2);}
[01].. {p(8);}
.. {p(16);}
%%
main(){yylex();}

Compile with:
lex mixed_base.l
cc -o mixed_base lex.yy.c

I think you can use 0[01]{7} instead of 0[01].{6}.

ES6, 86 80 bytes
Regex-based solution:
s=>s.replace(/0[01]{7}|[01]?../g,n=>String.fromCharCode(0+'bkxo'[n.length&3]+n))

Recursive non-regex solution for 95 bytes:
f=(s,r='')=>s?f(s.slice(l=s<'02'?8:s<'2'|2),r+String.fromCharCode(0+'bkxo'[l&3]+s.slice(0,l))):r

Python 3, 165 bytes
Without Regex
x=input();i=0;s=""
while i<len(x):
 a=x[i:i+2];c=int(a[0])
 if a in["00","01"]:y=8;b=2
 elif 1<c<8:y=2;b=16
 elif c<2:y=3;b=8
 s+=chr(int(x[i:i+y],b));i+=y
print(s)