text:
Analyse your Chair
This challenge is based on Downgoat's Adjust your chair.
Challenge
You just adjusted your new chair! It fits you perfectly. However, the wheel is squeaky and you know the repair people will change the adjustment. Problem is, you don't have a ruler, so you'll have to write a program to measure it for you.

The repair people can only wait for so long. So your code needs to be as short as possible.
Examples
O
|
|
| _
| |
|_|_
  |
  |
  O

5,3,2,2,1

O
|  _
|  |
|__|__
   |
   |
 __|__
 OOOOO

3,5,2,3,5

O
|      _
|______|______
 ______|______
 OOOOOOOOOOOOO

2,13,1,1,13

Chair parts
The chair has various components:
O  <- Headrest
|
|  <- Backrest
|  _  <- Armrest
|  |
|__|__ <- Seat
   |
   |   <- Leg
  _|_
  OOO  <- Wheels

Detailed Chair Descriptions
The parts of the chair are:

Headrest: There will always be one headrest above the backrest
O
|

Backrest: The number of | is the Backrest Height
O
|
|

Seat: The number of _ is the Seat Width, there is a | in the middle for the armrest.
__|__

Armrest: The number of | is the Armrest Height. This will be inserted in the middle of the seat.
_
|
|

Leg: The number of | is the Leg Height
|
|

Wheels: The wheels are centred below the legs. If they are more than one, all but the centre wheel will have _ in the line above them.
_ _
OOO

Output
Given a chair, you will be outputting various variables.
The output should be in the following order:

Backrest Height
Seat Width always odd
Armrest Height Always less than backrest height
Leg Height
Wheel count Always less than or equal to seat width and Always odd

The output may have a trailing newline, or be in an array / list form if it is a function.
Leaderboard

/* Configuration */

var QUESTION_ID = 67522; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 43394; // This should be the user ID of the challenge author.

/* App */

var answers = [],
  answers_hash, answer_ids, answer_page = 1,
  more_answers = true,
  comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" + QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function(data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function(data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+(?:[.]\d+)?)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if (OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });

  });

  valid.sort(function(a, b) {
    var aB = a.size,
      bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function(a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
      .replace("{{NAME}}", a.user)
      .replace("{{LANGUAGE}}", a.language)
      .replace("{{SIZE}}", a.size)
      .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/ b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i) {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
      .replace("{{NAME}}", lang.user)
      .replace("{{SIZE}}", lang.size)
      .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body {
  text-align: left !important
}
#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}
#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}
table thead {
  font-weight: bold;
}
table td {
  padding: 5px;
}

<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

        Author
        Language
        Size

Winners by Language

        Language
        User
        Score

      {{PLACE}}
      {{NAME}}
      {{LANGUAGE}}
      {{SIZE}}
      Link

      {{LANGUAGE}}
      {{NAME}}
      {{SIZE}}
      Link

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:
# [><>](http://esolangs.org/wiki/Fish), 121 bytes

Is the armrest measured?

Lua, 187 Bytes
I think I might be able to golf it some more, but I think this is good at the moment. Also, if the output needs to be comma-separated I can fix that, but this still meets the requirements methinks.
Also, input is fed in one line at a time. After the wheels are input, press enter with an an empty line to finalize input.
c={}i=1t=""while c[i-1]~=""do c[i]=io.read():gsub("%s+","")t=t..c[i]a=(not a and c[i]:find("_")and i or a)s=(not s and c[i]:find("_|_")and i or s)i=i+1 end print(s-1,c[s]:len()-1,s-a,#c-s-2,c[#c-1]:len())

Ungolfed
c={}
i=1
while c[i-1]~=""do
    c[i]=io.read():gsub("%s+","")          --remove spaces
    a=(not a and c[i]:find"_"and i or a)   --armrest position
    s=(not s and c[i]:find"_|_"and i or s) --seat position
    i=i+1
end
print(s-1, c[s]:len()-1, s-a, #c-s-2, c[#c-1]:len())

(Positions are measured top-to-bottom, so the top 'O' is position 1, and the wheels are the largest position.

Backrest height is the position of the seat minus one, compensating
for the 'O' at the top.
Seat size is the length of th string at the seat's position minus
one, compensating for the backrest.
Armrest height is the position of the seat minus the position of the
armrest.
Leg height is the height of the chair (#c) minus the position of
the seat minus 2, to compensate for the wheels and seat.
Wheel count is the length of the final string.

Groovy, 161 bytes!!!
Yay!! Not in last!!
f={s->a=s.split(/\n/)
b=a.findIndexOf{it.contains('|_')}
d=b-a.findIndexOf{it.contains('_')}
print"$b,${a[b].count('_')+1},$d,${a.size()-b-2},${s.count('O')-1}"}

Ungolfed:
f={String s ->
    split = s.split(/\n/)
    bottomOfChairBack = split.findIndexOf {it.contains('|_')}
    armHeight = bottomOfChairBack-split.findIndexOf {it.contains('_')}
    width = split[bottomOfChairBack].count('_')+1
    height = split.size() - bottomOfChairBack - 2

    wheelCount = s.count('O')-1
    return [bottomOfChairBack, width, armHeight, height, wheelCount]
}

Tests of ungolfed program:
assert f('''O
|
|
| _
| |
|_|_
  |
  |
  O''') == [5, 3, 2, 2, 1]

assert f('''O
|  _
|  |
|__|__
   |
   |
 __|__
 OOOOO''') == [3,5,2,3,5]

assert f('''O
|  _
|  |
|__|__
   |
   |
 __|__
 OOOOO''') == [3,5,2,3,5]

assert f('''O
|      _
|______|______
 ______|______
 OOOOOOOOOOOOO''') == [2,13,1,1,13]

Pyth, 57 54 53 50 bytes
Probably can be golfed further. -3 bytes thanks to issacg for the single character string trick.
=kjb.z
=H/k+b\|
-/k\_=G-/k\O2
--/k\|H=Nt/k+bd
N
hG

Explanation:
=kjb.z
=k              Assign k
     z          Input
  jb.           Join list by newlines

=H/k+b\|
=H              Assign H
  / +b\|        Count occurrences of "\n|"
   k            In input
                (Implicit: print backrest height)

-/k\_=G-/k\O2
     =G         Assign G
       -/k\O2   The number of wheels minus 1
-/k\_           Count the number of "_"
                (Implicit: print seat width)

--/k\|H=Nt/k+bd
       =N       Assign N
          /k+bd Count the number of lines starting with " "
         t      Subtract 1 (N is now the leg height)
  /k\|          Count the number of "|"
 -    H         Subtract the "|" for the backrest
-               Subtract leg height
                (Implicit: print armrest height)

N               Print leg height

hG              Print the number of wheels

To make a one-character string, use \. So "_" = \_

Ouch, no way am I going to beat this ;)

Perl, 93+2=95 90+1=91 83+1= 84 bytes
Apparently the output doesn't need comma-separating
Invoke with perl -n chair.pl chairInput (1B penalty for the flag).
END{print$b,2+$u-$o,$a,$.-$b-2,$o-1}$u+=s/_//g;$o+=s/O//g;s/^\|//&&$b++&&/\|/&&$a++

Ungolfed:
END{         # Put the END block first to save 1 ;
    print
        $b,
    2+$u-$o,
    $a,
    $.-$b-2, # $. is the number of lines total
    $o-1
}
$u+=s/_//g; # count _s incrementally
$o+=s/O//g; # count Os incrementally
s/^\|// && $b++ # it's backrest if it starts with |
    && /\|/ && $a++ # and it's armrest if it has another one

Previous version:
Invoke with perl -0n chair.pl < chairInput
s/^\|//&&$b++?/\|/&&$a++:$h++for split"
",$_;$,=",";print$b,2+s/_//g-($o=s/O//g),$a,$h-3,$o-1

Explanation:
s/^\|// && $back++   # the backrest is all lines starting with |
    ? /\|/ && $arm++ # the armrest is all of those lines with another |
    : $height++      # otherwise it counts for the seat height
    for split"
",$_;       # literal newline for 1 byte saved
$,=",";     # output separator
print
    $back,
    2+s/_//g-($o_count=s/O//g),  # you can find the seat size
                                 # from the different between the number
                                 # of Os and _s
    $arm,
    $height-3,
    $o_count-1

Python 3, 160 158 bytes
This code works but only on the following conditions: 1) armrest height > 0 otherwise the _ count breaks and 2) seat width > 1 otherwise the armrest blocks the width-one seat and the _ count breaks.
def f(s):
 a=s.split("\n");x=[];y=[];l=len(a)
 for i in range(l):
  m=a[i].count("_")
  if m:x+=i,;y+=m,
 return x[1],y[1]+1,x[1]-x[0],l-x[1]-2,s.count("O")-1


text:
Numerology Calculator
The goal of this challenge is to compute one kind of numerology digit from strings containing characters and numbers.

The input may be through any convenient method (standard input, arguments, separated file).
The input may contain any printable ASCII chars, but only alphanumerical (A-Z, a-z, and 0-9) have to be considered.
The output must be a digit between 1 and 9 or a star * if no letter and no digit where found... (or even 0 if input contain any number of 0 and nothing else but this doesn't matter).
Letter values are mapped in this way:
1  2  3  4  5  6  7  8  9
a  b  c  d  e  f  g  h  i
j  k  l  m  n  o  p  q  r
s  t  u  v  w  x  y  z

The numerology digit is computed by adding each value of string, then repeat until there is only one digit. Sample for 13579, Hello, world!, 00 0 00, !@#$%^&*();,  and 3.141592:
13579 => 1 + 3 + 5 + 7 + 9 = 25 => 2 + 5 = 7
Hello, world! => 8 + 5 + 3 + 3 + 6 + 5 + 6 + 9 + 3 + 4 = 52 => 5 + 2 = 7
00 0 00 => 0 + 0 + 0 + 0 + 0 = 0
!@#$%^&*(); => *
  => *
3.141592 => 3 + 1 + 4 + 1 + 5 + 9 + 2 = 25 => 2 + 5 = 7
3.1415926535897932384 =>
 3 + 1 + 4 + 1 + 5 + 9 + 2 + 6 + 5 + 3 + 5 + 8 + 9 + 7 + 9 + 3 + 2 + 3 + 8 + 4
 = 97 => 9 + 7 = 16 => 1 + 6 = 7

(This is great, most of this samples give 7! But it's just sample ;)
Some more tests:
Bob  => 2 + 6 + 2 = 10 => 1 + 0 = 1
Charlie => 3 + 8 + 1 + 9 + 3 + 9 + 5 = 38 => 3 + 8 = 11 => 1 + 1 = 2
Anna => 1 + 5 + 5 + 1 = 12 => 1 + 2 = 3
Fana => 6 + 1 + 5 + 1 = 13 => 1 + 3 = 4
Gregory => 7 + 9 + 5 + 7 + 6 + 9 + 7 = 50 => 5 + 0 = 5
Denis => 4 + 5 + 5 + 9 + 1 = 24 => 2 + 4 = 6
Erik => 5 + 9 + 9 + 2 = 25 => 2 + 5 = 7
Helen => 8 + 5 + 3 + 5 + 5 = 26 => 2 + 6 = 8
Izis => 9 + 8 + 9 + 1 = 27 => 2 + 7 = 9

This is a code-golf, so the shortest answer in bytes wins.
Shortest by language

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

0 will diseapear when added to anything else

0 is not relevant! Relevant output is between 1 and 9!

Could you add some examples featuring no alphanumeric characters?

I mean something like !@#$%^&*(); something which should return *.

It has been very hard to resist citing this in some of the technical-analysis discussions on the Money area...  ;-p

Matlab, 121 bytes
s=[input('','s'),'*'];while nnz(s)>1;s=num2str(sum(mod([s(48<s&s<58)-4,s(96<s&s<123)+2,s(64<s&s<91)-2],9)+1));end;disp(s)

Matlab is just not made for strings =(

Hey, at least it isn't as verbose as Mma :P

my +1, I couldn't do better. btw, is it necessary to put disp statement?

@brainkz Maybe, but I usually incude it to be on the safe side

Mathematica, 174 168 163 bytes
Catch[#-9Floor[Max[#-1,1]/9]&@If[(a=Tr[Characters@#/.{(b=a_String)?DigitQ:>FromDigits@a,b?LetterQ:>LetterNumber@a~Mod~9,b->0}])<1&&#~StringFreeQ~"0",Throw@"*",a]]&

Does the first step, then computes the digital root.

Ruby, 97 74 characters
n=->s{(t=eval s.tr('a-z9A-Z','1-9'*6).scan(/\d/)*?+)&&t>9?n[t.to_s]:t||?*}

Sample run:
2.1.5 :001 > n=->s{(t=eval s.tr('a-z9A-Z','1-9'*6).scan(/\d/)*?+)&&t>9?n[t.to_s]:t||?*}
 => #<Proc:0x00000001b4b3f0@(irb):4 (lambda)>

2.1.5 :002 > puts ['13579', 'Hello, world!', '00 0 00', '!@#$%^&*();', ' ', '3.141592', '3.1415926535897932384', 'Bob', 'Charlie', 'Anna', 'Izis'].map{|s|'%s : %s'%[n[s],s]}
7 : 13579
7 : Hello, world!
0 : 00 0 00
* : !@#$%^&*();
* :
7 : 3.141592
7 : 3.1415926535897932384
1 : Bob
2 : Charlie
3 : Anna
9 : Izis

Perl, 91 89 76 74 bytes
73 + 1 for -p switch
s/[a-z]/(ord($&)%32-1)%9+1/eig;$t="*",s/\d/$t+=$&/eg,$_=$t until/^[*\d]$/

Tests
for test in '13579' 'Hello, world!' '00 0 00' '!@#$%^&*();' ' ' \
    '3.141592' '3.1415926535897932384' \
    Bob Charlie Anna Fana Gregory Denis Erik Helen Izis ;do
    perl -pe '
      s/[a-z]/(ord($&)%32-1)%9+1/eig;$t="*",s/\d/$t+=$&/eg,$_=$t until/^[*\d]$/
      ' < <(echo -n "$test")
    echo "  $test"
done

7  13579
7  Hello, world!
0  00 0 00
*  !@#$%^&*();
*
7  3.141592
7  3.1415926535897932384
1  Bob
2  Charlie
3  Anna
4  Fana
5  Gregory
6  Denis
7  Erik
8  Helen
9  Izis

Thanks @manatwork for helping me to save 2 14 16 15 17 chars!!
... I've thinked about: N % 32 + Y may replace ( N & 31 ) + Y!

If you capture the whole matched substring, $1 is equal with $&. So better remove the capturing and change the variable name.

@manatwork, Strange, I remember trying this before and use parenthesis while this not worked as expected... I don't understand/remember my previous tests (second s/../../eg use already $& finely)... Thanks anyway!

while's block could be $t="*";s/\d/$t+=$&/eg;$_=$t.

Oh yes! I whipped this because of Argument "*" isn't numeric in addition (+) at -e line 2, <> line 1., but... Who care about -w switch?

Sorry, but its actually 1 character longer, as you should include the -p switch in the count.

Sorry again (this time a bigger sorry), but it fails on single non-word character input, for example “!” results the same ”!”. (Seems to work because with here-string the input is always passed with a trailing  newline, so in your test cases never passes single character input. Use echo -n "$test" | perl -pe '…' to see what I mean.) You can solve it by changing the while condition to !/^[\d*]$/. While there, to reduce the score loss, you may replace the entire while with this: $t="*",s/\d/$t+=$&/eg,$_=$t until/^[\d*]$/.

There is one more improvement you can do. As & has lower precedence than +, while % has higher, change &31 → %32 and you can remove the parentheses around that subexpression.

ES6, 98 bytes
s=>(m=s.match(/[1-9a-z]/gi))?(t=8,m.map(c=>t+=c>'@'?c.charCodeAt()&31:+c),t%9+1):/0/.test(s)?0:'*'

Ungolfed:
function(s) {
    var m = s.match(/[1-9a-z]/gi);
    if (m) {
        var t = 0;
        for (var i = 0; i < m.length; i++) {
            if (m[i] > '@')
                t += m[i].charCodeAt(0) & 31;
            else
                t += parseInt(m[i]);
        }
        return t % 9 || 9;
    }
    return /0/.test(s) ? 0 : "*";
}

94-byte version that only works on short strings:
s=>(m=s.match(/[1-9a-z]/gi))?m.map(c=>c>'@'?c.charCodeAt()&31:c).join``%9||9:/0/.test(s)?0:'*'

Using match, map and join turned out to be shorter than using replace twice:
s=>(m=s.replace(/[^1-9a-z]/gi,''))?m.replace(/[a-z]/gi,c=>c.charCodeAt()&31)%9||9:/0/.test(s)?0:'*'

Test it here: https://jsbin.com/zizosayisi/edit?js,console

This doesn't work for the input 00 0 00

@rink.attendant.6 Ah, the REPL I was using just prints ["0"] as 0 so I couldn't tell the difference.

Much, much better than @rink.attendant.6 version! Clever golf hacks used. Could you explain > '@', & 31 and || 9?

@Pavlo > '@' just distinguishes between letters and numbers. & 31 is a useful way of ignoring the difference between upper and lower case character codes, as it also conveniently directly maps character codes into 1..26 values. || 9 is used because % 9 returns 0 for multiples of 9 but repeatedly adding digits returns 9 for non-zero multiples of 9. In the golfed code I use (t + 8) % 9 + 1 instead which comes to the same thing.

The language is commonly named "JavaScript (ES6)"

Gema, 161 characters
*=@n{*}
n:\A=@set{t;};<L1>=@set{t;@add{$t;@add{@mod{@sub{@mod{@char-int{$0};32};1};9};1}}};<D1>=@set{t;@add{$t;$0}};?=;\Z=@cmps{$t;;;\*;@cmpn{$t;9;$t;$t;@n{$t}}}

(Written only to try whether recursive domain calls work.)
Sample run:
bash-4.3$ for input in '13579' 'Hello, world!' '00 0 00' '!@#$%^&*();' ' ' '3.141592' '3.1415926535897932384'; do
>     echo -n "'$input' : "
>     gema '*=@n{*};n:\A=@set{t;};<L1>=@set{t;@add{$t;@add{@mod{@sub{@mod{@char-int{$0};32};1};9};1}}};<D1>=@set{t;@add{$t;$0}};?=;\Z=@cmps{$t;;;\*;@cmpn{$t;9;$t;$t;@n{$t}}}' <<< "$input"
>     echo
> done
'13579' : 7
'Hello, world!' : 7
'00 0 00' : 0
'!@#$%^&*();' : *
' ' : *
'3.141592' : 7
'3.1415926535897932384' : 7

MATL, 64 bytes
jk42ht`YUt'[a-z]'XXY}3+w'[1-9]'XXY}6+h,9X\st9>]w2Y24Y2h!=~?x'*']

This uses current version (4.0.0) of the language.
I have a feeling that it could be made shorter...
Test cases
>> matl
 > jk42ht`YUt'[a-z]'XXY}3+w'[1-9]'XXY}6+h,9X\st9>]w2Y24Y2h!=~?x'*']
 >
> 13579
7

>> matl
 > jk42ht`YUt'[a-z]'XXY}3+w'[1-9]'XXY}6+h,9X\st9>]w2Y24Y2h!=~?x'*']
 >
> Hello, world!
7

>> matl
 > jk42ht`YUt'[a-z]'XXY}3+w'[1-9]'XXY}6+h,9X\st9>]w2Y24Y2h!=~?x'*']
 >
> 00 0 00
0

>> matl
 > jk42ht`YUt'[a-z]'XXY}3+w'[1-9]'XXY}6+h,9X\st9>]w2Y24Y2h!=~?x'*']
 >
> !@#$%^&*();
*

>> matl
 > jk42ht`YUt'[a-z]'XXY}3+w'[1-9]'XXY}6+h,9X\st9>]w2Y24Y2h!=~?x'*']
 >
> 3.141592
7

>> matl
 > jk42ht`YUt'[a-z]'XXY}3+w'[1-9]'XXY}6+h,9X\st9>]w2Y24Y2h!=~?x'*']
 >
> 3.1415926535897932384
7

>> matl
 > jk42ht`YUt'[a-z]'XXY}3+w'[1-9]'XXY}6+h,9X\st9>]w2Y24Y2h!=~?x'*']
 >
> Bob
1

>> matl
 > jk42ht`YUt'[a-z]'XXY}3+w'[1-9]'XXY}6+h,9X\st9>]w2Y24Y2h!=~?x'*']
 >
> Charlie
2

>> matl
 > jk42ht`YUt'[a-z]'XXY}3+w'[1-9]'XXY}6+h,9X\st9>]w2Y24Y2h!=~?x'*']
 >
> Anna
3

>> matl
 > jk42ht`YUt'[a-z]'XXY}3+w'[1-9]'XXY}6+h,9X\st9>]w2Y24Y2h!=~?x'*']
 >
> Izis
9

Unfortunely, I could'nt test your sample. Please post whole test cases, including recently added tests (sorry).

@F.Hauri Yes, you'd need Matlab to test them. Sorry about that, no online compiler yet. I've added the test cases

JavaScript (ES6), 162 159 157 bytes
f=_=>{for(_=_.replace(/\W+/g,''),g=$=>''+[...$.toUpperCase()].reduce((p,a)=>isNaN(a)?p+(a.charCodeAt()-64)%9:+a+p,0);1<(l=_.length);_=g(_));return!l?'*':g(_)}

Still trying to look for a way to use implicit return in the outer function.
Ungolfed + unminified
f = str => {
  str = str.replace(/\W+/g, '');
  recursiveFunc = $ => String([...$.toUpperCase()].reduce(
    (prev, val) => isNaN(val) ? prev + (val.charCodeAt() - 64) % 9 : Number(val) + prev,
    0
  ));
  while (1 < (len = str.length)) {
    str = recursiveFunc(str);
  }
  return len === 0 ? '*' : recursiveFunc(str)
}

Strips out all non-alphanumeric characters
Calls a function recursively to reduce the characters to their respective values while the string is longer than 1 character.

Converts the string to uppercase to easily work with ASCII codes
Convert to array using spread operator and run an accumulator
Use the global isNaN function (which casts its input) to check if it's not a number

If it isn't, convert to ASCII code and mod 9 to get its respective value
If it is a number, cast it

If the length is 0, no alphanumeric characters were present (return an asterisk), otherwise return the output of the recursive function.

This break rule 00 0 00, output * instead of  0!

@F.Hauri Fixed.

You can avoid explicit return by using comman operator: _=>{expr;return expr} => _=>(expr,expr)

@Pavlo How do I apply that in my case?

Doesn't work for me, throws SyntaxError: https://jsbin.com/havotusoqa/1/edit?js,console

Haskell, 126 bytes
l x=[n|(c,n)<-zip(['0'..'9']++['a'..'z']++'\0':['A'..'Z'])$0:cycle[1..9],c==x]
g[]="*"
g[x]=show x
g x=f$show$sum x
f=g.(l=<<)

Usage: f "Hello, world!" -> "7".
l is  a lookup table for characters to list of integers (singleton list, if char is found, empty list otherwise). f lookups every char of it's argument and flattens the returned list of lists into a simple list of integers and calls g to check the end condition (empty list (-> *) or single integer) or to call f with the sum of the list for another round.

Pure bash, 199 194 bytes
eval a+={a..z};r="$1";while [ "${r:1}" ];do o=;for ((i=0;i<${#r};i++));do
l=${r:i:1};case $l in [a-zA-Z])d=${a%${l,}*};((o+=$((${#d}%9+1))));;[0-9])
((o+=l));;esac;done;r="$o";done;echo "${o:-*}"

(second line break is only for avoiding scrollbar)
Test rule:
numerology() {
    eval a+={a..z};
    r="$1";
    while [ "${r:1}" ]; do
        o=;
        for ((i=0; i<${#r}; i++))
        do
            l=${r:i:1};
            case $l in
                [a-zA-Z])
                    d=${a%${l,}*};
                    ((o+=$((${#d}%9+1))))
                ;;
                [0-9])
                    ((o+=l))
                ;;
            esac;
        done;
        r="$o";
    done;
    echo "${o:-*}"
}

for test in '13579' 'Hello, world!' '00 0 00' '!@#$%^&*();' ' ' \
            '3.141592' '3.1415926535897932384'\
            Bob Charlie Anna Fana Gregory Denis Erik Helen Izis ;do
    echo "$(numerology "$test")" $test
done

7 13579
7 Hello, world!
0 00 0 00
* !@#$%^&*();
*
7 3.141592
7 3.1415926535897932384
1 Bob
2 Charlie
3 Anna
4 Fana
5 Gregory
6 Denis
7 Erik
8 Helen
9 Izis

Seriously, 50 bytes
,$ù;ú1╤▀+;#pX╗@-@-;Y`'*.`╬X1WX`╜í;s9*@%u`MΣ$;lDWX

Hex Dump:
2c24973ba331d1df2b3b237058bb402d402d3b5960272a2e7f
60ce5831575860bda13b73392a402575604de4243b6c445758

Try It Online
Explained:
,$ù                                               Read input, make it a string, lowercase
    ú                                             Push lowercase alphabet
     1╤▀+                                         Prepend base 10 digits.
         ;#pX╗                                    Remove "0" from a copy and stash in reg0
   ;          @-                                  Remove alphanumerics from input copy
                @-                                Remove nonalphanumerics from input
                  ;Y                              Push 1 if string is empty, else 0
                    `'*.`╬                        If top is truthy, output * and halt
                          X                       Discard boolean
                           1                      Push 1 to enter loop
                            WX                 WX Loop while top of stack is truthy
                              `         `M        Map this function over the string
                               ╜                  Push alphanumeric string from reg0
                                í                 Push index of this char in it
                                 ;s9*             Push 9 if found, else -9
                                     @%u          Take index mod previous: this yields the
                                                  correct conversion from the numerology
                                          Σ       Sum the resulting digits.
                                           $      Convert the sum to a string.
                                            ;lD   push 1 less than its length

@F.Hauri Click "Try It Online". enter your test cases in the input box.

Pyth, 39 bytes
IK@J+jkUTGrz0WtK=K`smh%xtJd9-K\0)K).?\*

Try It Online
I'm just doing this because I can't sleep. Maybe I'll explain it tomorrow...

JavaScript (ES6), 78 83
Recursive solution. Being tail recursion, the variables t and r have not to be local.
f=x=>(t=r=0,x.replace(/\w/g,d=>t+=1+~-parseInt(d,r=36)%9),t>9?f(''+t):r?t:'*')

Explained
f=x=>(
  t = 0, // set initial value of counter to 0
  r = 0, // flag to verify that we found at last one alphanumeric chars
  x.replace(/\w/g, d => ( // execute the following for each alphanumeric character
    // t += 1 + ~-parseInt(d,r=36) % 9 explained below
    r = 36, // set flag, could be any nonzero value
    d = parseInt(d,36), // convert to numeric. a..z -> 10..25, case insensitive.
    d = 1 + (d-1) % 9, // this is the arithmetic conversion required (
                       // works also with 0 because the strange implementation of % in javascript for negative numbers
    t = t + d // add to global counter
  ) ),
  t > 9 // if t > 9 then we found some alphanumeric char, but we must repeat the loop on t
    ? f(''+t) // recursive call, t is numeric and must become a string
    : r // check flag r
      ? t // if alphanumeric found, return t
      : '*' // else return '*'
)

Test snippet

f=x=>(t=r=0,x.replace(/\w/g,d=>t+=1+~-parseInt(d,r=36)%9),t>9?f(''+t):r?t:'*')

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

;[['13579',7],['Hello, world!',7],['00 0 00',0],['!@#$%^&*();','*'],
['3.141592',7],['3.1415926535897932384',7],
['Bob', 1],['Charlie', 2],['Anna', 3],['Fana', 4],['Gregory', 5],
['Denis', 6],['Erik', 7],['Helen', 8],['Izis', 9]]
.forEach(t=>{
  i=t[0]+''
  k=t[1]
  r=f(i)
  console.log(i+' -> ' + r + (k==r? ' OK':' Fail - expected '+k))
  })

Mathematica, 133 bytes
f[s_]:= ToCharacterCode@ToUpperCase@s-64/.{a_/;17>-a>6:>a+16,b_/;b<1||b>26:>""}//If[Or@@NumberQ/@#,Tr@#/.""->0//.a_:>Tr@IntegerDigits@a,"*"]&

A bit different from LegionMammal978's above. My function turns everything into a character code, then filters out the non-alphanumeric things (replacing them with empty strings). If there are no alphanumerics, then it returns *, otherwise it takes the digital root. This could be significantly (~15B) shorter if I didn't have to deal with the all-zeros-string case. C'est la vie.
Mathematica magic, for the uninitiated: foo//.a_:>Tr@IntegerDigits@a is a repeated replacement: it replaces any numbers a in foo with the sum of their digits, then it replaces again until it hits a fixed point, i.e. a stops changing under replacement.
Tests:
f /@ {"13579", "Hello,world!", "00 0 00", "!@#$%^&*()", "3.141592","3.1415926535897932384"}
     => {7, 7, 0, "*", 7, 7}
f /@ {"Bob", "Charlie", "Anna", "Fana", "Gregory", "Denis", "Erik",  "Helen", "Izis"}
     => {1, 2, 3, 4, 5, 6, 7, 8, 9}

Unfortunely, I could'nt test your sample. Please post test cases

On my way. While putting together the tests, I've also found some typos to fix. Thanks ;)

source: Stack Exchange

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

sort: votes


text:
Mask an IP address and give its broadcast
Background
Inspired by this Unix.SE question (and of course my own answer).
When an IP address is specified for an interface, it is often given in this dotted-decimal form:
a.b.c.d e.f.g.h

where a.b.c.d is the actual address and e.f.g.h is the netmask.
The netmask, when represented in binary, is basically a bunch of 1 bits followed by a bunch of 0 bits.  When the netmask is bitwise ANDed against the given IP address, result will be the network portion of the address, or simply the network address.  This will be programmed into the host's route table so that the host knows to send anything destined for this network out this interface.
The broadcast address for a network is derived by taking the network address (from above) and setting all the host-bits to 1.  The broadcast address is used to send to all addresses within the given network.
Challenge
Given a dotted-decimal IP address and valid netmask as input, provide the network address and broadcast address as output, also in dotted-decimal format.

Input must be address and mask as two strings in dotted-decimal format.  You may pass this as 2 separate strings, as list or array of 2 string elements or a single string with the address and mask separated by some sensible separator.
Output format is subject to the same constraints as input format.

Examples
Input                              Output

192.168.0.1 255.255.255.0          192.168.0.0 192.168.0.255
192.168.0.0 255.255.255.0          192.168.0.0 192.168.0.255
192.168.0.255 255.255.255.0        192.168.0.0 192.168.0.255
100.200.100.200 255.255.255.255    100.200.100.200 100.200.100.200
1.2.3.4 0.0.0.0                    0.0.0.0 255.255.255.255
10.25.30.40 255.252.0.0            10.24.0.0 10.27.255.255

Will the netmask only have 255s and 0s?

@xnor The last example has 252 in it.

Shouldn't the last output be 10.24.0.0 10.27.255.255?

@xnor no, the net masks can be any length from 0 to 32

@Pietu1998 no, 255.252.0.0 is a valid mask. In binary it is 11111111.11111100.00000000.00000000

Yeah, but I mean that the given broadcast output is 00001010000110110000000000000000 (the last bits are not 1's).

@Pietu1998 Oh yeah - sorry - its fixed now.

JavaScript (ES6), 92 bytes
(a,m)=>a.split`.`.map((n,i)=>(v=m[i],m[i]=n&v|v^255,n&v),m=m.split`.`).join`.`+" "+m.join`.`

Explanation
(a,m)=>
  a.split`.`
  .map((n,i)=>(
      v=m[i],
      m[i]=n&v|v^255,
      n&v
    ),
    m=m.split`.`
  ).join`.`
  +" "+m.join`.`

Test

var solution = (a,m)=>a.split`.`.map((n,i)=>(v=m[i],m[i]=n&v|v^255,n&v),m=m.split`.`).join`.`+" "+m.join`.`
<input type="text" id="input" value="10.25.30.40 255.252.0.0" />
<button onclick="result.textContent=solution.apply(null,input.value.split` `)">Go</button>

MATL, 47 bytes
This answer uses current version (4.0.0) of the language.
'%i.%i.%i.%i't32whh2:"j'\d+'XXU]tbZ&tb255Z~+hYD

Example
>> matl
 > '%i.%i.%i.%i't32whh2:"j'\d+'XXU]tbZ&tb255Z~+hYD
 >
> 192.168.0.1
> 255.255.255.0
192.168.0.0 192.168.0.255

Explanation
'%i.%i.%i.%i't32whh      % format string: '%i.%i.%i.%i %i.%i.%i.%i'
2:"                      % for loop: do this twice
    j'\d+'XXU            % input string and parse into 4-vector with the numbers
]                        % end
tbZ&                     % compute network address
tb255Z~+                 % compute broadcast address
hYD                      % concatenate into 8-vector and apply format string

Pyth, 44 42 bytes
LisMcb\.256Lj\..[04jb256'J.&yzKyw'+JxKt^2 32

Try it online. Test suite.
Expects the input as an array, like ["10.25.30.40", "255.252.0.0"].

PHP, 126 bytes
With input in $n:
preg_filter(~Ð×£ÔÖÐ,~Û¤¢Â×ÛÎÖÑ×ÛÔÔÁÌÀ×ÛÑÂ×ÛÂÛÁÊÀÝÑÝÅÝÝÖÑ×Û¤ÛÒÊ¢ÙÛÎÖÖÑ×ÛÑÂÛÑ×Û¤ÛÒÊ¢ÍÊÊÙÛÎÖÖÅÝÝÖ,$n);echo"$c $b";

Hexdump:
0000000: 7072 6567 5f66 696c 7465 7228 7ed0 d7a3  preg_filter(~...
0000010: 9bd4 d6d0 9a2c 7edb 9ea4 a2c2 d7db ced6  .....,~.........
0000020: d1d7 db96 d4d4 c1cc c0d7 db9c d1c2 d7db  ................
0000030: 8bc2 db96 c1ca c0dd d1dd c5dd ddd6 d1d7  ................
0000040: db9e a4db 96d2 caa2 d9db ced6 d6d1 d7db  ................
0000050: 9dd1 c2db 8bd1 d7db 9ea4 db96 d2ca a283  ................
0000060: cdca cad9 81db ced6 d6c5 dddd d62c 246e  .............,$n
0000070: 293b 6563 686f 2224 6320 2462 223b       );echo"$c $b";

And a more readable version:
preg_filter( /* PCRE regex on input */
    '/(\d+)/e', /* match all digits, execute the code for each one */
    '$a[]=($1) /* push the matched value to the array $a */
        .($i++>3 /* if we're at the 5th or higher digit */
            ?($c.=($t=$i>5?".":"").($a[$i-5]&$1)) /* append to $c bitwise AND-ed number */
                .($b.=$t.($a[$i-5]|255&~$1)) /* append to $b the broadcast address */
            :"")',
    $n);
echo"$c $b"; /* output $c and $b */

preg_filter requires a single statement in the replacement pattern when using the e flag, so I 'append' the result of the calculations to the 5th and higher values of $a, because those are never reused.

Perl, 90 85 bytes
includes +6 for -pF/\D/
for(0..3){push@a,$F[$_]&1*($y=$F[$_+4]);push@b,$F[$_]|~$y&255}$"='.';$_="@a @b"

Usage:
echo "192.168.0.1 255.255.255.0" | perl -pF/\\D/ file.pl

More readable:
for(0..3) {
    push @a, $F[$_] & 1*($y=$F[$_+4]);  # calc/add network address 'byte'
    push @b, $F[$_] | ~$y & 255         # calc/add broadcast address 'byte'
}
$"='.';                                 # set $LIST_SEPARATOR
$_="@a @b"                              # set output to network address and broadcast

The -F/\D/ splits the input on non-digits and stores it in @F.

Factor, 103 bytes
[ [ ipv4-aton ] bi@ 2dup bitand -rot dup bit-count 32 - abs on-bits pick bitor 2nip [ ipv4-ntoa ] bi@ ]

Nice.
Ungolfed:
: mask-and-broadcast ( ip mask -- netaddr broadcast )
  [ ipv4-aton ] bi@ 2dup bitand -rot dup bit-count 32 - abs on-bits pick bitor 2nip
  [ ipv4-ntoa ] bi@ ;

PHP, 74 bytes
<?=long2ip($i=ip2long($argv[1])&$m=ip2long($argv[2])),' ',long2ip($i|~$m);

As a standalone, input is via command line:
$ php ip.php 192.168.0.1 255.255.255.0
192.168.0.0 192.168.0.255

Try it online!
Or as a function, 80 bytes:
function($a,$b){return[long2ip($i=ip2long($a)&$m=ip2long($b)),long2ip($i|~$m)];}

Try it online!
Ungolfed
function ip( $a, $b ) {
    $i = ip2long( $a );          // string IP to 32 bit int
    $m = ip2long( $b );          // string netmask to 32 bit int
    $n = $i & $m;                // network is bitwise AND of IP and netmask
    $c = $i | ~$m;               // broadcast is bitwise OR of IP and inverse netmask
    return [ long2ip( $n ), long2ip( $c ) ];
}

PHP has nice (albeit with long function names) built-ins to handle IPv4 dotted-string to binary and back.
Output
192.168.0.1 255.255.255.0   => 192.168.0.0 192.168.0.255
192.168.0.0 255.255.255.0   => 192.168.0.0 192.168.0.255
192.168.0.255 255.255.255.0 => 192.168.0.0 192.168.0.255
100.200.100.200 255.255.255.255 => 100.200.100.200 100.200.100.200
1.2.3.4 0.0.0.0 => 0.0.0.0 255.255.255.255
10.25.30.40 255.252.0.0 => 10.24.0.0 10.27.255.255

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:
...And Mexico will Pay for It!
Donald Trump is very impressed with the work of the people on this site. He saw how amazing of a job you did helping Ben Carson, so he even hired you to build his wall. He thinks you're terrific. Now he needs your help again. While he has successfully built his wall, now he needs the Mexican government to pay for it. He wants to charge $1 million a mile, and he has told them that the U.S.-Mexico border is 1,989 miles long. However they are not quite sure this number is accurate, so they would like a to-scale visual representation as well. That's where you come in. You are to take this map:

and for every n (50 <= n <= 500) miles on the border draw a 25 pixel-length line, perpendicular to the slope of the border at that point. Using the scale on the right-hand side of the map, I've determined that 100 miles ~ 50 pixels. I've drawn a sample of the first 3 lines for n=60, but these are only approximate:

Notes:

The only input is n. Output should be the map image, with the lines added, drawn to the screen or saved in a raster image file (you can overwrite the original map file).
You can save the blank map file with whatever file name you want. It is a JPEG, but you can convert it to another common raster format if you prefer. Also, you can reduce the size of the image by up to 50%, as long as you keep the dimensions proportional, and your lines are still to scale.
Each line should be perpendicular to the slope of the border at that point. The slope should be calculated starting 50 miles before the point and ending 50 miles after the point.

Accuracy:

The slope of each line can have a margin of error of ±5°
The spacing between each line can have a margin of error of ±20 miles (10 pixels on the regular map).

The price $10000/mile is probably off by a factor of 100, unless by "wall" you mean 3 strands of barbed wire installed by laborers making $2.50/hour.

Also, Mma states that the U.S.-Mexico border is about 1952 miles long.

Good to know, but the important thing is neither of those numbers mean anything for this challenge.

@geokavel Go ahead and answer it.

@programmer5000 Is it at possible (I'm honestly not sure how bounties exactly work) to extend the deadline of the bounty? I have a Python answer in the works, but I'm busy at the moment and I'm not sure I can complete it by the end of the time period.

Additionally, is the intention of this challenge to be able to process the image and identify the border before drawing the lines, or is it acceptable to just be able to draw the lines without actually processing the image (essentially assuming what the image will be like)?

Python 2 + numpy + OpenCV, 576 bytes

from cv2 import*
from numpy import*
n=input()/4
f="m.png"
i=imread(f)
b=array([0]*3)
y=array([165,195,225])
j=inRange(i,b,b+120)
k=inRange(i,y,y+25)
for x,y in zip(*where(j)):j[x,y]=k[x+3,y]-j[x+1,y]>1
j=j[506:732,152:557]
p=[array([11,9])]
for c in sorted(zip(*where(j)),key=lambda c:c[1]):r=range(p[-1][1]+1,c[1]+1);p+=map(array,zip(map(int,interp(r,*zip(p[-1],c)[::-1])),r))
for x,c in enumerate(p[25:-25:n]):s=-1/true_divide(*p[x*n+50]-p[x*n+25]);k=6/(1+s**2)**.5;line(i,*map(tuple,[(c+[int(k*s)+506,int(k)+152])[::-1],(c-[int(k*s)-506,int(k)-152])[::-1],b]))
imwrite(f,i)

This program is almost entirely ungolfed, and there are aspects of it that are somewhat inaccurate at the moment, but at least it works for the most part. Additionally, there is a little bit of hardcoding, but it's only for an approximate window enclosing the border and the coordinate of the first pixel on the border (the latter of which I will actually most likely remove later).
The image used by the program is halved in area (i.e. 1120 x 865), and so the length of lines drawn and the distance between lines is smaller.

cool!! great to see an answer!

suggest to delete unworking tio link

gif demo https://i.stack.imgur.com/RWQu4.gif . Apply my edit

@ЕвгенийНовиков Thanks for the gif! It's much more illustrative (and succint) than the pictures I had before.

authors: Евгений Новиков


text:
Parse the resistors
The aim is simple: given the string of resistance values, draw the part of "electrical circuit" of those resistors. Examples follow.

Input: 3. Output:
--3--

Input: 1,2,3. Output:
--1----2----3--

Next, the resistors can be joined parallel (by 2 or 3 resistors per join), but the required depth of parallel joins is only 1.

Input: 1|2. Output:
 |--1--|
-|     |-
 |--2--|

Input: 1|2|3. Output:
 |--1--|
-|--2--|-
 |--3--|

Note, that --2-- resistor is now centered.
Input: 1|2,3|4|5. Output:
 |--1--|  |--3--|
-|     |--|--4--|-
 |--2--|  |--5--|

Combined joins:

Input: 1,2,3|4,5,6|7|8,9. Output:
           |--3--|       |--6--|
--1----2---|     |---5---|--7--|---9--
           |--4--|       |--8--|

If it would be more convenient, the input can be a two-dimensional array. I.e. the input for the last example would look like this: [1,2,[3,4],5,[6,7,8],9].
Some notes:

No other forms of (in|out)puts are allowed.
The resistance of each resistor can vary in the range from 1 to 9. Other values, like -, 42 or 0 are disallowed.
The joins like 1|2|3|4 are invalid. As already mentioned, max 3 per parallel join. Empty joins, i.e. ...,|,... or ...,,... are invalid.
Oh, and this is code golf :)

Thanks for the correction, it's a fixed numbers of dashes. The separate resistors are preceded and followed by two dashes.

Can the first and third line be padded with spaces to even the length of the lines?

@Tfeld Trailing/leading spaces are allowed before/after the whole output, but not between the resistors.

Are leading/trailing empty lines allowed when there are no parallel resistors?

@Pietu Hm, let it be yes :)

Both [1,2,[3,4],5,[6,7,8],9] and [[1],[2],[3,4],[5],[6,7,8],[9]] fine?

Python 2, 195 bytes
a=b=c=''
B=' '*5
H='--'
S=' |'+H;E=H+'| '
for x in input():
 if x>9:a+=S+`x[0]`+E;c+=S+`x[-1]`+E;b+='-|'+[B,H+`x[1]`+H][len(x)>2]+'|-'
 else:b+=H+`x`+H;a+=B;c+=B
print[b,a+'\n'+b+'\n'+c]['|'in a]

Takes input as:
[1,2,[3,4],5,[6,7,8],9]

Output:
           |--3--|       |--6--|
--1----2---|     |---5---|--7--|---9--
           |--4--|       |--8--|

Save a few bytes by making H a function lambda V:f'--{V}--'?

Vyxal, 64 bytes
ƛI⁼[h\-dpømð5*:‟W|ƛ`|--`pøm;:L2=[÷`|   `øm$W]];DvhṄ,ƛ1i;\-j,vtṄ,

Try it Online!

05AB1E, 45 42 bytes
ε€…--ÿDgið.ø.BëÁð3×ª3£À'|ì… - SδìÅ\]€.ºøJ»

Try it online!

JavaScript (Node.js), 149 bytes
n=>(H=M=>n.map(e=>(T=e[M]||e[1])?` |${(G=e=>`--${e}--`)(T)}| `:'     ').join``)(0)+`
${n.map(e=>+e?G(e):`-|${e[2]?G(e[1]):'     '}|-`).join``}
`+H(2)

Try it online!
No need to overcomplicate things, just keep it simple

Haskell, 132 bytes
foldr(zipWith(:))e.(>>=g)
a=" - "
b="|||"
s%c=[a,b,c,c,s,c,c,b,a]
g[x]=[a,a,' ':x:" ",a,a]
g[x,y]=[x,' ',y]%"- -"
g z=z%"---"
e=[]:e

Try it online!
Takes input as a [[Char]] and outputs a list of lines.

Julia 1.5, 129 bytes
s=" "^5
+x="--$x--"
!x=map(*,[" |","-|"," |"],x,["| ","|-","| "])
-x=[[s,.+x,s],![+x[1],s,+x[(l=end;)]],!.+x][l]
~x=map(*,.-x...)

Try it online!
output is a list of lines


text:
Draw the Pentaflake
First of all ... I would like to wish everyone a Merry Christmas (sorry if I am a day late for your timezone).
To celebrate the occasion, we are going to draw a snowflake. Because the year is 2015 and Christmas is on the 25th (for a large portion of persons), we will draw a Pentaflake. The Pentaflake is a simple fractal composed of pentagons. Here are a few examples (taken from here):
Each Pentaflake has an order n. The Pentaflake of order 0 is simply a pentagon. For all other orders n, a Pentaflake is composed of 5 Pentaflakes of the previous order arranged around a 6th Pentaflake of the previous order. For example, a Pentaflake of order 1 is composed of 5 pentagons arranged around a central pentagon.
Input
The order n. This may be given in any way except that of a predefined variable.
Output
An image of the order n Pentaflake. Must be at least 100px wide and 100px long. It may be saved to a file, displayed to the user, or outputted to STDOUT. Any other form of output is not allowed. All image formats existing before this challenge are allowed.
Winning
As codegolf, the person with the least number of bytes wins.

-1 because snowflakes only have 6 fold symmetry! =D

@flawr According to this article only about .1% of snowflakes actually have 6-fold symmetry ... or any symmetry at all. However, those snowflakes that do have symmetry can have 3-fold symmetry in addition to 6-fold symmetry :P

Well this article only studied way less than .1% of all snowflakes, and it is meaningless anyway, as they only studied american snowflakes. I bet metric snowflakes are way more symmetrical! (PS: Beautiful images! Snowflake #167 is especially interesting!) (I just noticed that metric snowflakes must have 10-fold symmetry.)

Is it necessary to have a self-contained function as an answer? I could shave off a few bytes if matlab scripts are also allowed (i.e. just a sequence of commands rather than a function). I'll edit according to this, and revert if it's not OK after all.

It will be okay as long as it outputs using one of the above methods. However, n cannot be predefined in your script file. You can read n from STDIN, prompt it from the user, take it as a function / commad line argument ... basically anything you want except for directly embedding it in your code.

Don't want to +1 this because it has 25 :(

Don't want to +1 this because it has 25 :(

Matlab, 226
function P(M);function c(L,X,Y,O);hold on;F=.5+5^.5/2;a=2*pi*(1:5)/5;b=a(1)/2;C=F^(2*L);x=cos(a+O*b)/C;y=sin(a+O*b)/C;if L<M;c(L+1,X,Y,~O);for k=1:5;c(L+1,X+x(k),Y+y(k),O);end;else;fill(X+x*F, Y+y*F,'k');end;end;c(0,0,0,0);end

Ungolfed:
function P(M);
function c(L,X,Y,O);          %recursive function
hold on;
F=.5+5^.5/2;                  %golden ratio
a=2*pi*(1:5)/5;               %full circle divided in 5 parts (angles)
b=a(1)/2;
C=F^(2*L);
x=cos(a+O*b)/C;               %calculate the relative position ofnext iteration
y=sin(a+O*b)/C;
if L<M;                       %current recursion (L) < Maximum (M)? recurse
    c(L+1,X,Y,~O);            %call recursion for inner pentagon
    for k=1:5;
        c(L+1,X+x(k),Y+y(k),O)%call recursion for the outer pentagons
    end;
else;                         %draw
    fill(X+x*F, Y+y*F,'k');
end;
end;
c(0,0,0,0);
end

Fifth iteration (already took quite a while to render).

A slight alteration of the code (unfortunately more bytes) results in this beauty=)

Oh, and another one:

Thanks for pointing me to this challenge, I went and added another solution, hope you don't mind;) I'm safely away from your byte-count, anyway, I just found it too interesting to miss.

MATLAB, 235 233 217 bytes
Update: a bunch of suggestions from @flawr helped me lose 16 bytes. Since only this allowed me to beat flawr's solution, and that I wouldn't have found the challenge without flawr's help in the first place, consider this a joint submission by us:)
N=input('');f=2*pi/5;c=1.5+5^.5/2;g=0:f:6;p=[cos(g);sin(g)];R=[p(:,2),[-p(2,2);p(1,2)]];for n=1:N,t=p;q=[];for l=0:4,q=[q R^l*[c-1+t(1,:);t(2,:)]/c];end,p=[q -t/c];end,p=reshape(p',5,[],2);fill(p(:,:,1),p(:,:,2),'k');

This is another MATLAB solution, this one based on a philosophy of iterated function systems. I was mostly interested in developing the algorithm itself, and I haven't golfed too much on the solution. There's surely room for improvement. (I contemplated using a hard-coded fixed-point approximation for c, but that wouldn't be nice.)
Ungolfed version:
N=input('');                                % read order from stdin

f=2*pi/5;                                   % angle of 5-fold rotation
c=1.5+5^.5/2;                               % scaling factor for contraction

g=0:f:6;
p=[cos(g);sin(g)];                          % starting pentagon, outer radius 1
R=[p(:,2),[-p(2,2);p(1,2)]];                % 2d rotation matrix with angle f

for n=1:N,                                  % iterate the points
    t=p;
    q=[];
    for l=0:4,
       q=[q R^l*[c-1+t(1,:);t(2,:)]/c];     % add contracted-rotated points
    end,
    p=[q -t/c];                             % add contracted middle block
end,

p=reshape(p',5,[],2);                 % reshape to 5x[]x2 matrix to separate pentagons
fill(p(:,:,1),p(:,:,2),'k');          % plot pentagons

Result for N=5 (with a subsequent axis equal off for prettiness, but I hope that doesn't count byte-wise):

I think you could save a few bytes by using R=[p(:,2),[-p(2,2);p(1,2)]]; (and eliminating the previous R,C,S) and you can use q=[q R^l*[c-1+t(1,:);t(2,:)]/c] and I think c=1.5+5^.5/2;

@flawr obviously you're right:) 1. thanks for the rotation matrix, 2. thanks for the new q, I even had a needless pair of parentheses in there... 3. thanks, but what is this magic??:D 4. since the solution is now shorter than your original, I consider this to be partly your submission as well.

Mathematica, 200 bytes
a=RotationTransform
b=Range
r@k_:={Re[t=I^(4k/5)],Im@t}
R@k_:=a[Pi,(r@k+r[k+1])/2]
Graphics@Nest[GeometricTransformation[#,ScalingTransform[{1,1}(Sqrt@5-3)/2]@*#&/@Append[R/@b@5,a@0]]&,Polygon[r/@b@5],#]&

The last line is a function which can be applied to an integer n.
Mathematica function names are long. Somebody should entropy-encode them and make a new language from it. :)
When applied to 1:

When applied to 2:

Mathematica, 124 bytes
Mathematica supports new syntax for Table since version 10: Table[expr, n], which saves another byte.
Table[expr, n] is equivalent to Table[expr, {n}].
f@n_:=(p=E^Array[π.4I#&,5];Graphics@Map[Polygon,ReIm@Fold[{g,s}~Function~Join[.62(.62g#+#&/@s),{-.39g}],p,p~Table~n],{-3}])

The core of this function is using complex numbers to do tranformations and then convert them to points by ReIm.
Test case:
f[4]

π takes up two bytes in UTF-8, so you come out to 125 bytes total.

OMFG what is this

Mathematica, 199 196 bytes
Edging out Peter Richter's answer by a hair, here's one of my own. It leans heavily on graphics functionality, and less on math and FP. The CirclePoints builtin is new in 10.1.
c=CirclePoints;g=GeometricTransformation;
p@0=Polygon@c[{1,0},5];
p@n_:=GraphicsGroup@{
        p[n-1],
        g[
          p[n-1]~g~RotationTransform[Pi/5],
          TranslationTransform/@{GoldenRatio^(2n-1),n*Pi/5}~c~5
        ]
      };
f=Graphics@*p

Edit: Thanks to DumpsterDoofus for GoldenRatio

You can save 3 bytes by replacing ((1+Sqrt@5)/2) with GoldenRatio. Also in the second line I think it should be p@0=Polygon@c[{1,0},5]; instead of p@0=Polygon@cp[{1,0},5];. (BTW I'm actually Peter, I've got two profiles lol).

Yes! Good call. I spotted the typo, too, but forgot to fix it. D'oh,

Mathematica, 130 bytes
r=Exp[Pi.4I Range@5]
p=1/GoldenRatio
f@0={r}
f@n_:=Join@@Outer[1##&,r,p(f[n-1]p+1),1]~Join~{-f[n-1]p^2}
Graphics@*Polygon@*ReIm@*f

I use a similar technique to njpipeorgan's answer (in fact I stole his 2Pi I/5 == Pi.4I trick), but implemented as a recursive function.
Example usage (using % to access the anonymous function that was output on the last line):
 %[5]

Wolfram Language (Mathematica), 96 90 84bytes
Region@Polygon@ReIm@Nest[Join[Tr/@Tuples@{.62p,t=.39#},-t]&,{p=(-1)^(.4Range@5)},#]&


text:
Ratio of Uppercase Letters to Lowercase
In this challenge you and your friends are debating on which case is better, uppercase or lowercase? To find out, you write a program to do this for you.
Because esolangs scare your friends, and verbose code scares you, your code will need to be as short as possible.

Examples
PrOgRaMiNgPuZzLeS & CoDe GoLf
0.52 uppercase

DowNGoAT RiGHtGoAt LeFTGoat UpGoAT
0.58 uppercase

Foo BaR Baz
0.56 lowercase

Specifications
The input will consist only of ASCII characters. All non-alphabetic characters should be ignored. There will be at least 1 character of each case
The output should be the amount of the case that appears the most often over the total amount of alphabetic characters. It should be a decimal accurate to at least 2 decimal places. If uppercase appears more often, the output should end with uppercase, or lowercase.
There will never the the same amount of uppercase and lowercase characters.

Esolangs do not scare my friends. Does that mean my code can be wildly verbose?

@AlexA. verbose code scares you, so your code will also need to be golfed.

Oh right, I had forgotten about my recurring Java nightmares.

Will there be input with only one case?

Does "accurate to at least 2 decimal places" require at least two decimals to be printed, or can a second decimal of zero be left out?

@hvd a second decimal of zero may be left out or kept. Your choice

There will be at least 1 character of each case I think you mean 1 alphabetic character?

Pyth - 40 bytes
This is the first time i've ever used vectorized string formatting which is pretty cool.
Kml-zrzd2eS%Vm+cdsK" %sercase"Kc"upp low

Test Suite.

JavaScript (ES6) 87 bytes
Edit 1 byte saved thx ETHProductions
Edit 1 more byte saved thx l4me
An anonymous function. Long, but I didn't find a way to golf this more
s=>(l=t=0,s.replace(/[a-z]/ig,c=>l+=++t&&c>'Z'),l/=t,l<.5?1-l+' upp':l+' low')+'ercase'

Less golfed
s=>( // arrow function returning the value of an expression
  // here I use comma for clarity,
  // in the golfed version it's all merged in a single expression
  t = 0, // counter for letters
  l = 0, // counter for lowercase letters
  s.replace(
    /[a-z]/ig, // find all alphabetic chars, upper or lowercase
    c => // execute for each found char (in c)
        l += ++t && c>'Z', // increment t, increment l if c is lowercase
  ),
  l /= t, // l is the ratio now
  ( l < .5 // if ratio < 1/2
    ? (1-l) +' upp' // uppercase count / total (+" upp")
    : l +' low'     // lowrcase count / total (+" low")
  ) + 'ercase' // common suffix
)

I believe you could save one byte by using &&` ${t-l>l?1-l/t+'upp':l/t+'low'}ercase` .

Also, c=>l+=++t&&c>'Z' would work, I think...?

@ETHproductions your first hint does not seem useful, the second is clever, thx

Can we see the ungolfed version with an explanation?

@Cyoce explanation added - it's simple in fact

@ETHproductions you should post that trick by itself as a JavaScript golf tip

I think @ETHproductions meant in the first tip to do s=>s.replace(/[a-z]/ig,c=>l+=++t&&c>'Z',l=t=0)&&` ${t-l>l?1-l/t+'upp':l/t+'low'}ercase` which would save 1 byte.

@ןnɟuɐɯɹɐןoɯ That is correct, but it doesn't work properly; the result will be e.g. 0.58uppercase with an extra space at the beginning.

Oh well... it was worth a try. I guess.

Move the replace into the bracket to save a char

@l4m2 right, and now I can even restore the logic order of operations putting the initialization of t and l before the replace

CJam, 47 45 bytes
q__eu-\_el-]:,_:+df/" low upp"4/.+:e>"ercase"

Try it online.
Not golfing for too long...
Explanation
q               e# Read input.
__eu-           e# Get only the lowercase characters.
\_el-           e# Get only the uppercase characters.
]:,             e# Get the lengths of the two strings.
_:+             e# Sum of the lengths.
df/             e# Lengths divided by the sum of the lengths.
" low upp"4/.+  e# Append the first number with " low" and the second " upp"
:e>             e# Find the maximum of the two.
"ercase"        e# Output other things.

Japt, 58 bytes
A=Uf"[a-z]" l /Uf"[A-Za-z]" l)>½?A+" low":1-A+" upp" +`ÖÐ

(Note: SE stripped a special char, before Ö, so please click the link to get the proper code)

Nice work! Your first regex (including the dollar signs) can be replaced with "[a-z]", and the second with "A-Za-z". 0.5 is equal to ½. You can also remove the final quotation mark.

With the mentioned changes and string compression, I get 58: A=Uf"[a-z]" l /Uf"[A-Za-z]" l)>½?A+" low":1-A+" upp" +`\x80ÖÐ You can obtain the raw version of the last three bytes with Oc"ercase.

@Eth \x80 didn't appear to do anything, and ÖÐ produced "case"... Maybe some invisi-chars that got truncated? Btw, provided my own mod, thanks for the tips

@ETH Ok, managed to use that invisi-char :)

Unfortunately, backslashes have to be doubled inside strings for the regex parser to work. In this cases, "\w" simply matches all ws, and "\\w" matches all of A-Za-z0-9_. So I think you'll need to keep "[a-z]".

@Eth LOL and I wondered why it did work :DD

R, 133 123 118 108 106 105 104 bytes
Golfed down 10 bytes thanks to @ovs,8 thanks to @Giuseppe, and 10 again thanks to @ngm. At this point it's really a collaborative effort where I provide the bytes and others take them off ;)
function(x)cat(max(U<-mean(utf8ToInt(gsub('[^a-zA-Z]',"",x))<91),1-U),c("lowercase","uppercase")[1+2*U])

Try it online!

shaved off 1 more byte.

Julia, 76 74 bytes
s->(x=sum(isupper,s)/sum(isalpha,s);(x>0.5?"$x upp":"$(1-x) low")"ercase")

This is a lambda function that accepts a string and returns a string. To call it, assign it to a variable.
Ungolfed:
function f(s::AbstractString)
    # Compute the proportion of uppercase letters
    x = sum(isupper, s) / sum(isalpha, s)

    # Return a string construct as x or 1-x and the appropriate case
    (x > 0.5 ? "$x upp" : "$(1-x) low") * "ercase"
end

Saved 2 bytes thanks to edc65!

U can surely save 2 bytes using ercase instead of case

@edc65 Great idea, thanks!

MATL, 49 50 bytes
Uses current version (4.1.1) of the language, which is earlier than the challenge.
jt3Y2m)tk=Ymt.5<?1w-YU' upp'h}YU' low'h]'ercase'h

Examples
>> matl
 > jt3Y2m)tk=Ymt.5<?1w-YU' upp'h}YU' low'h]'ercase'h
 >
> PrOgRaMiNgPuZzLeS & CoDe GoLf
0.52 uppercase

>> matl
 > jt3Y2m)tk=Ymt.5<?1w-YU' upp'h}YU' low'h]'ercase'h
 >
> Foo BaR Baz
0.55556 lowercase

Explanation
j                   % input string
t3Y2m)              % duplicate. Keep only letters
tk=Ym               % duplicate. Proportion of lowercase letters
t.5<?               % if less than .5
    1w-             % compute complement of proportion
    YU' upp'h       % convert to string and append ' upp'
}                   % else
    YU' low'h       % convert to string and append ' low'
]                   % end
'ercase'            % append 'ercase'

Python 2, 114 110 bytes
i=input()
n=1.*sum('@'<c<'['for c in i)/sum(c.isalpha()for c in i)
print max(n,1-n),'ulpopw'[n<.5::2]+'ercase'

You can save 2 bytes by replacing ['upp','low'][n<.5] with 'ulpopw'[n<.5::2], and 3 more by replacing [n,1-n][n<.5] with max(n,1-n).

106 bytes

Perl 6,  91 70 69 63  61 bytes

{($/=($/=@=.comb(/\w/)).grep(*~&' 'ne' ')/$/);"{$/>.5??$/!!1-$/} {<low upp>[$/>.5]}ercase"} # 91

{$/=m:g{<upper>}/m:g{\w};"{$/>.5??$/!!1-$/} {<low upp>[$/>.5]}ercase"} # 70

{"{($/=m:g{<upper>}/m:g{\w})>.5??$/!!1-$/} {<low upp>[$/>.5]}ercase"} # 69

{"{($/=m:g{<upper>}/m:g{\w})>.5??"$/ upp"!!1-$/~' low'}ercase"} # 63

{"{($/=m:g{<:Lu>}/m:g{\w})>.5??"$/ upp"!!1-$/~' low'}ercase"} # 61

Usage:
# give it a lexical name
my &code = {...}

.say for (
  'PrOgRaMiNgPuZzLeS & CoDe GoLf',
  'DowNGoAT RiGHtGoAt LeFTGoat UpGoAT',
  'Foo BaR Baz',
)».&code;

0.52 uppercase
0.580645 uppercase
0.555556 lowercase

Strike-through code blocks? That's something new...

Lose 3 chars by swapping ternary for max("0.55 upp","0.45 low"): Try It

C#, 135 bytes
Requires:
using System.Linq;

Actual function:
string U(string s){var c=s.Count(char.IsUpper)*1F/s.Count(char.IsLetter);return(c>0.5?c+" upp":1-c+" low")+"ercase";}

With explanation:
string U(string s)
{
    var c = s.Count(char.IsUpper) // count uppercase letters
               * 1F               // make it a float (less bytes than (float) cast)
               / s.Count(char.IsLetter); // divide it by the total count of letters
    return (c > 0.5
        ? c + " upp"  // if ratio is greater than 0.5, the result is "<ratio> upp"
        : 1 - c + " low") // otherwise, "<ratio> low"
        + "ercase"; // add "ercase" to the output string
}

Mathematica, 139 105 bytes
a=ToString;If[(b=1.#~(c=StringCount)~Alphabet[]/c[#,_?LetterQ])<.5,a[1-b]<>" upp",a@b<>" low"]<>"ercase"&

Verbose code is scary, but I'll have to live with it...

Ruby, 81+1=82
With flag -p,
$_=["#{r=$_.count(a='a-z').fdiv$_.count(a+'A-Z')} low","#{1-r} upp"].max+'ercase'

It's lucky that for numbers between 0 and 1, lexicographic sorting is the same as numeric sorting.

PHP, 140 129 characters
My first round of golf -- not too bad for a 'standard' language, eh? :-)
Original:
function f($s){$a=count_chars($s);for($i=65;$i<91;$i++){$u+=$a[$i];$l+=$a[$i+32];}return max($u,$l)/($u+$l).($u<$l?' low':' upp').'ercase';}

Shortened to 129 characters thanks to @manatwork:
function f($s){$a=count_chars($s);for(;$i<26;$u+=$a[$i+++65])$l+=$a[$i+97];return max($u,$l)/($u+$l).' '.($u<$l?low:upp).ercase;}

With comments:
function uclcratio($s)
{
  // Get info about string, see http://php.net/manual/de/function.count-chars.php
  $array = count_chars($s);

  // Loop through A to Z
  for ($i = 65; $i < 91; $i++) // <91 rather than <=90 to save a byte
  {
    // Add up occurrences of uppercase letters (ASCII 65-90)
    $uppercount += $array[$i];
    // Same with lowercase (ASCII 97-122)
    $lowercount += $array[$i+32];
  }
  // Compose output
  // Ratio is max over sum
  return max($uppercount, $lowercount) / ($uppercount + $lowercount)
  // in favour of which, equality not possible per challenge definition
         . ($uppercount < $lowercount ? ' low' : ' upp') . 'ercase';
}

Given the $u+=…, I suppose you already have error_reporting on default, so silencing warnings. Then remove some quotes: ' '.($u<$l?low:upp).ercase.

If you would have only one statement to repeat by the for, you could remove the braces around it. for($i=65;$i<91;$u+=$a[$i++])$l+=$a[$i+32];

With the price of another warning, you can spare the for control variable initialization by looping 0..26 instead of 65..91: for(;$i<26;$u+=$a[$i+++65])$l+=$a[$i+97];

Wow, thank you @manatwork, I didn't know how tolerant PHP is! :D The second one is very smart. I implemented your ideas, bringing the count to 140-4-5-2 = 129 :-)

Common Lisp, 132 bytes
(setq s(read-line)f(/(count-if'upper-case-p s)(count-if'alpha-char-p s)))(format t"~f ~aercase"(max f(- 1 f))(if(> f .5)"upp""low"))

Try it online!

In the test 0.52 is uppercase not lowercase...

@RosLuP, corrected, thanks a lot!

CoffeeScript, 104 characters
 (a)->(r=1.0*a.replace(/\W|[A-Z]/g,'').length/a.length)&&"#{(r>.5&&(r+' low')||(1-r+' upp'))+'ercase'}"

coffeescript was initially trying to pass the intended return value as an argument to the "r" value, which failed and was super annoying because r was a number, not a function. I got around it by placing an && between the statements to separate them.

Pyth, 54 53
One byte saved thanks to @Maltysen
K0VzI}NG=hZ)I}NrG1=hK;ceS,ZK+ZK+?>ZK"low""upp""ercase

Try it online
K0                  " Set K to 0
                    " (Implicit: Set Z to 0)

Vz                  " For all characters (V) in input (z):
  I}NG              " If the character (N) is in (}) the lowercase alphabet (G):
    =hZ             " Increment (=h) Z
  )                 " End statement
  I}NrG1            " If the character is in the uppercase alphabet (rG1):
    =hK             " Increment K
;                   " End all unclosed statements/loops

c                   " (Implicit print) The division of
  e                 " the last element of
    S,ZK           " the sorted (S) list of Z and K (this returns the max value)
+ZK                 " by the sum of Z and K

+                   " (Implicit print) The concatenation of
  ?>ZK"low""upp"    " "low" if Z > K, else "upp"
  "ercase"          " and the string "ercase".

,<any><any> is a two arity command that is the same as [<any><any>) which can save you a byte

Seriously, 58 bytes
" upp"" low"k"ercase"@+╗,;;ú;û+∩@-@-;l@ú@-l/;1-k;i<@╜@ZEεj

Hex Dump:
22207570702222206c6f77226b2265726361736522402bbb2c3b3ba33b
962bef402d402d3b6c40a3402d6c2f3b312d6b3b693c40bd405a45ee6a

It only works on the downloadable interpreter...the online one is still broken.
Explanation:
" upp"" low"k"ercase"@+╗                                    Put [" lowercase"," uppercase"]
                                                            in reg0
                        ,;;ú;û+∩@-@-                        Read input, remove non-alpha
                                    ;l@                     Put its length below it
                                       ú@-                  Delete lowercase
                                          l                 Get its length
                                           /                Get the ratio of upper/total
                                            ;1-k            Make list [upp-ratio,low-ratio]
                                                ;i<         Push 1 if low-ratio is higher
                                                   @        Move list to top
                                                    ╜@Z     Zip it with list from reg0
                                                       E    Pick the one with higher ratio
                                                        εj  Convert list to string.

Pyth, 45 bytes
AeSK.e,s/LzbkrBG1s[cGshMKd?H"upp""low""ercase

Try it online. Test suite.
Explanation
             rBG1               pair of alphabet, uppercase alphabet
    .e                          map k, b over enumerate of that:
      ,                           pair of
           b                          lowercase or uppercase alphabet
        /Lz                           counts of these characters in input
       s                              sum of that
                                    and
            k                         0 for lowercase, 1 for uppercase
   K                            save result in K
 eS                             sort the pairs & take the larger one
A                               save the number of letters in and the 0 or 1 in H

s[                              print the following on one line:
  cG                              larger number of letters divided by
    shMK                            sum of first items of all items of K
                                    (= the total number of letters)
        d                         space
         ?H"upp""low"             "upp" if H is 1 (for uppercase), otherwise "low"
                     "ercase      "ercase"

Ruby, 97 characters
->s{'%f %sercase'%[(l,u=[/[a-z]/,/[A-Z]/].map{|r|s.scan(r).size}).max.fdiv(l+u),l>u ?:low: :upp]}

Sample run:
2.1.5 :001 > ['PrOgRaMiNgPuZzLeS & CoDe GoLf', 'DowNGoAT RiGHtGoAt LeFTGoat UpGoAT', 'Foo BaR Baz'].map{|s|->s{'%f %sercase'%[(l,u=[/[a-z]/,/[A-Z]/].map{|r|s.scan(r).size}).max.fdiv(l+u),l>u ?:low: :upp]}[s]}
 => ["0.520000 uppercase", "0.580645 uppercase", "0.555556 lowercase"]

REXX, 144 bytes
a=arg(1)
l=n(upper(a))
u=n(lower(a))
c.0='upp';c.1='low'
d=u<l
say 1/((u+l)/max(u,l)) c.d'ercase'
n:return length(space(translate(a,,arg(1)),0))

141 bytes

Pyth, 40 39 bytes
Jml@dQrBG1+jdeS.T,cRsJJc2."kw""ercase

Try it here
Explanation
Jml@dQrBG1+jdeS.T,cRsJJc2."kw""ercase
 m    rBG1                                For the lower and uppercase alphabet...
  l@dQ                                    ... count the occurrences in the input.
J                 cRsJJ                   Convert to frequencies.
               .T,     c2."kw"          Pair each with the appropriate case.
             eS                           Get the more frequent.
          +jd                    "ercase  Stick it all together.

PowerShell Core, 134128 bytes
Filter F{$p=($_-creplace"[^A-Z]",'').Length/($_-replace"[^a-z]",'').Length;$l=1-$p;(.({"$p upp"},{"$l low"})[$p-lt$l])+"ercase"}

Try it online!
Thanks, Veskah, for saving six bytes by converting the function to a filter!

You can save two free bytes by making it a filter instead of a function, i.e. filter F(code)

I never knew this was a thing!  Thanks, Veskah!

Perl 5 -p, 72 bytes
$_=(($u=y/A-Z//)>($l=y/a-z//)?$u:$l)/($u+$l).$".($u>$l?upp:low).'ercase'

Try it online!

Kotlin, 138 bytes
Code
let{var u=0.0
var l=0.0
forEach{when{it.isUpperCase()->u++
it.isLowerCase()->l++}}
"${maxOf(u,l)/(u+l)} ${if(u>l)"upp" else "low"}ercase"}

Usage
fun String.y():String =let{var u=0.0
var l=0.0
forEach{when{it.isUpperCase()->u++
it.isLowerCase()->l++}}
"${maxOf(u,l)/(u+l)} ${if(u>l)"upp" else "low"}ercase"}

fun main(args: Array<String>) {
    println("PrOgRaMiNgPuZzLeS & CoDe GoLf".y())
    println("DowNGoAT RiGHtGoAt LeFTGoat UpGoAT".y())
    println("Foo BaR Baz".y())
}

Tcl, 166 bytes
proc C s {lmap c [split $s ""] {if [string is u $c] {incr u}
if [string is lo $c] {incr l}}
puts [expr $u>$l?"[expr $u./($u+$l)] upp":"[expr $l./($u+$l)] low"]ercase}

Try it online!

05AB1E, 28 bytes
ʒ.u}gság/Dò©_αð„Œ„›…#'ƒß«®èJ

Try it online!

ʒ.u}g                        # filter all but uppercase letters, get length.
     ság/                    # Differential between uppercase and input length.
         Dò©                 # Round up store result in register w/o pop.
            _α               # Negated, absolute difference.
              ð              # Push space.
               „Œ„›…         # Push "upper lower"
                    #        # Split on space.
                     'ƒß«    # Concat "case" resulting in [uppercase,lowercase]
                         ®èJ # Bring it all together.

Java 8, 136 130 bytes
s->{float l=s.replaceAll("[^a-z]","").length();l/=l+s.replaceAll("[^A-Z]","").length();return(l<.5?1-l+" upp":l+" low")+"ercase";}

-6 bytes creating a port of @ProgramFOX' C# .NET answer.
Try it online.
Explanation:
s->{                  // Method with String as both parameter and return-type
  float l=s.replaceAll("[^a-z]","").length();
                      //  Amount of lowercase
  l/=l+s.replaceAll("[^A-Z]","").length();
                      //  Lowercase compared to total amount of letters
  return(l<.5?        //  If this is below 0.5:
          1-l+" upp"  //   Return `1-l`, and append " upp"
         :            //  Else:
          l+" low")   //   Return `l`, and append " low"
        +"ercase";}   //  And append "ercase"

C (gcc), 124 121 119 118 bytes
u,l;f(char*x){for(u=l=0;*x;x++)isalpha(*x)?*x>96?l++:u++:0;printf("%f %sercase\n",fmax(l,u)/(u+l),u>l?"upp":"low");}

Try it online!
Slightly ungolfed
u,l;
f(char*x){
  for(u=l=0;*x;x++)
    isalpha(*x)?*x>96?l++:u++:0;
  printf("%f %sercase\n",fmax(l,u)/(u+l),u>l?"upp":"low");
}

C, 120 bytes
f(char*a){int m=0,k=0,c;for(;isalpha(c=*a++)?c&32?++k:++m:c;);printf("%f %sercase",(m>k?m:k)/(m+k+.0),m>k?"upp":"low");}

test and result:
main()
{char *p="PrOgRaMiNgPuZzLeS & CoDe GoLf", *q="DowNGoAT RiGHtGoAt LeFTGoat UpGoAT", *m="Foo BaR Baz";
 f(p);printf("\n");f(q);printf("\n");f(m);printf("\n");
}

results
0.520000 uppercase
0.580645 uppercase
0.555556 lowercase

It suppose Ascii character set.

116 bytes

@ceilingcat you can update your to that 116 bytes... This 120 bytes for me if is enough...

APL(NARS), 58 char, 116 bytes
{m←+/⍵∊⎕A⋄n←+/⍵∊⎕a⋄∊((n⌈m)÷m+n),{m>n:'upp'⋄'low'}'ercase'}

test:
  h←{m←+/⍵∊⎕A⋄n←+/⍵∊⎕a⋄∊((n⌈m)÷m+n),{m>n:'upp'⋄'low'}'ercase'}
  h "PrOgRaMiNgPuZzLeS & CoDe GoLf"
0.52 uppercase
  h "DowNGoAT RiGHtGoAt LeFTGoat UpGoAT"
0.5806451613 uppercase
  h "Foo BaR Baz"
0.5555555556 lowercase

Javascript 80 characters
I'm bad at this but here was my go at Javascript:
a=(s)=>{let a=0,b=0;for(c in s)s[c]==s[c].toUpperCase()?a++:b++;return a/(a+b);}

Readable version:
a=(s)=>{
    let a=0,b=0;
    for(c in s)
        s[c]==s[c].toUpperCase()?a++:b++;
    return a/(a+b);
}

Function is called with: a('hEllO') which outputs 0.4 for example.
I feel like there must be a way to condense the arrow function or something with the words return or toUpperCase that I can do.

I think you also need to mention whether there was more uppercase or lowercase. And you need to print the one of which there was more (so if there's more uppercase than lowercase, you have to print that).

Oh true... Woops, thanks for the catch

WDC 65816 machine code, 159 bytes
Hexdump:
00000000: a200 009b 8006 e600 9002 e601 b200 f016  ................
00000010: c941 90f2 c95b b003 e880 ebc9 6190 e7c9  .A...[......a...
00000020: 7bb0 e3c8 80e0 c220 8602 9865 0285 04c4  {...... ...e....
00000030: 0290 0ea9 6c6f 850f a977 6585 1184 0280  ....lo...we.....
00000040: 0aa9 7570 850f a970 6585 11a9 6400 8508  ..up...pe...d...
00000050: 6406 a900 0018 6502 c504 9006 e504 e606  d.....e.........
00000060: 80f6 c608 d0ef 0ac5 0490 02e6 06a9 302e  ..............0.
00000070: 850a a900 2085 0da9 7263 8513 a961 7385  .... ...rc...as.
00000080: 15a9 6500 8517 a230 00a5 06c9 0a00 9006  ..e....0........
00000090: e90a 00e8 80f5 e230 6930 850d 860c 60    .......0i0....`

Assembly:
; pointer to null-terminated string is in $00-$01
; enter in 8-bit accumulator mode (SEP #$20), 16-bit index mode (REP #$10)
; output is a null-terminated string starting at $0A, ends at $18
count:
    ; X - number of uppercase chars
    ; Y - number of lowercase chars
    LDX #$0000
    TXY
    BRA .firstiter
.loop:
    INC $00
    BCC .firstiter
    INC $01
.firstiter:
    LDA ($00)
    BEQ calc_maj
    CMP #$41 ; 'A'
    BCC .loop
    CMP #$5B ; 'Z'+1
    BCS +
    INX
    BRA .loop
+   CMP #$61 ; 'a'
    BCC .loop
    CMP #$7B ; 'z'+1
    BCS .loop
    INY
    BRA .loop
calc_maj:
    ; okay, now the hard part
    ; $02 is amount of lowercase
    ; $04 is total
    REP #$20
    STX $02
    TYA
    ADC $02
    STA $04
    CPY $02
    BCC +
    ; Y > X thus more lowercase
    LDA #$6F6C ; 'lo'
    STA $0A+5
    LDA #$6577 ; 'we'
    STA $0A+7
    STY $02
    BRA ++
+   ; Y < X => more uppercase
    LDA #$7075 ; 'up'
    STA $0A+5
    LDA #$6570 ; 'pe'
    STA $0A+7
++  ; now $02 is the amount of larger and the buffer's upper/lower word is already initialized
    LDA.w #100
    STA $08
    STZ $06
    LDA #$0000
.divmul_outer:
    CLC : ADC $02
.divmul_inner:
    CMP $04
    BCC +
    SBC $04
    INC $06
    BRA .divmul_inner
+   DEC $08
    BNE .divmul_outer
    ; if tmp * 2 >= $04: inc $06
    ASL
    CMP $04
    BCC +
    INC $06
+   ; $6 now contains $02 * #100 / $04
    ; let's write all the other letters while we're still in 16bit mode
    ; 0.XX XXXXrcase\0
    LDA #$2E30 ; "0."
    STA $0A
    LDA #$2000 ; "\0 "
    STA $0A+3
    LDA #$6372 ; "rc"
    STA $0A+9
    LDA #$7361 ; "as"
    STA $0A+11
    LDA #$0065 ; "e\0"
    STA $0A+13
    LDX #$0030
    LDA $06
-   CMP #$000A
    BCC +
    SBC #$000A
    INX
    BRA -
+   SEP #$30
    ADC #$30
    STA $0A+3
    STX $0A+2
    RTS

(assembled with Asar. The +/- things are labels.)
Input: A 16-bit pointer to the string to count, null terminated.
Output: A null-terminated string starting at $0A (and ending at $18).
Enter in 8-bit accumulator, 16-bit index mode. (SEP #$20 REP #$10)
God I hate this CPU. Will optimize tomorrow maybe.

Gema, 125 characters
\A=@set{l;0}@set{u;0}
<J1>=@incr{l}
<K1>=@incr{u}
?=
\Z=0.@div{@cmpn{$l;$u;$u;;$l}00;@add{$l;$u}} @cmpn{$l;$u;upp;;low}ercase

Sample run:
bash-4.3$ for input in 'PrOgRaMiNgPuZzLeS & CoDe GoLf' 'DowNGoAT RiGHtGoAt LeFTGoat UpGoAT' 'Foo BaR Baz'; do
>     gema '\A=@set{l;0}@set{u;0};<J1>=@incr{l};<K1>=@incr{u};?=;\Z=0.@div{@cmpn{$l;$u;$u;;$l}00;@add{$l;$u}} @cmpn{$l;$u;upp;;low}ercase' <<< "$input"
>     echo " <- $input"
> done
0.52 uppercase <- PrOgRaMiNgPuZzLeS & CoDe GoLf
0.58 uppercase <- DowNGoAT RiGHtGoAt LeFTGoat UpGoAT
0.55 lowercase <- Foo BaR Baz

-1 because esolangs scare your friends. (jk, upvoted)

Matlab, 110 bytes
Solution
i=input('','s');a=sum(i>64&i<91);b=sum(i>96&i<123);d=a>b;disp([num2str(max(a,b)/(a+b)),' upp'*d+' low'*~d,'ercase'])

Test:
i='PrOgRaMiNgPuZzLeS & CoDe GoLf';
0.52 uppercase
i='DowNGoAT RiGHtGoAt LeFTGoat UpGoAT';
0.58065 uppercase
i='Foo BaR Baz'
0.55556 lowercase

Pure Bash, 183 185 182 179  bytes
+2 +4 bytes for more golfing.
(Second linebreak is there only to avoid scrollbar, so not counted).
o=({upp,low}ercase) q=;eval s+={A..Z};b="${1//[$s]}";eval s+={a..z}
c="${1//[$s]}";b=$[(${#1}-${#b})*64#fE/(${#1}-${#c})];((b<40#ck))&&
q=1 b=$[41#og-b];printf "%.2f ${o[q]}\n" .$b

Sample:
(set -- "Foo BaR Baz";o=({upp,low}ercase) q=;eval s+={A..Z};b="${1//[$s]}"
eval s+={a..z};c="${1//[$s]}";b=$[(${#1}-${#b})*64#fE/(${#1}-${#c})];((b<
40#ck))&&q=1 b=$[41#og-b];printf "%.2f ${o[q]}\n" .$b)
0.56 lowercase

or
ulRatio() { local b c s o=({upp,low}ercase) q=;eval s+={A..Z};b="${1//[$s]}"
eval s+={a..z};c="${1//[$s]}";b=$[(${#1}-${#b})*64#fE/(${#1}-${#c})];((b<40\
#ck))&&q=1 b=$[41#og-b];printf "%.2f ${o[q]}\n" .$b;}

for string in "PrOgRaMiNgPuZzLeS & CoDe GoLf" \
        "DowNGoAT RiGHtGoAt LeFTGoat UpGoAT" "Foo BaR Baz" ;do
    echo -e "\\n$string"
    ulRatio "$string"
  done

PrOgRaMiNgPuZzLeS & CoDe GoLf
0.52 uppercase

DowNGoAT RiGHtGoAt LeFTGoat UpGoAT
0.58 uppercase

Foo BaR Baz
0.56 lowercase

Candy, 62 84 bytes
The legit answer is:
b0a(~x#97<{0|1}~y#32*XW-#65-=xX0#27w{ibY+})bZ/="ercase"A12/<{1A-p"upp"|Ap"low"}(;)N;

But adding a range operator and literal characters to Candy, it gets shorter:
(~`a`zw{i}A`A`Zw{v})"ercase"YZY+/~12/>{Ap"upp"|1A-p"low"}(;)N;

Long form as:
while
  peekA
  "a" "z" between
  if
    incrZ
  endif
  pushA
  "A" "Z" between
  if
    incrY
  endif
endwhile
"ercase"
pushY
pushZ pushY add
div
peekA
digit1 digit2 div
greater
if
  pushA print
  "upp"
else
  digit1 pushA sub print
  "low"
endif
while
  printChr
endwhile
digit10 printChr  # linefeed

Clojure, 149 bytes
#(let[C(for[c(re-seq #"[a-zA-Z]"%)](pos?(compare"["c)))[k v](last(sort-by val(frequencies C)))](str(float(/ v(count C)))" "(if k"upp""low")"ercase"))


text:
Merry Christmas (and a Happy New Year)
The goal of this challenge is to create a program that outputs a string depending on the time of year.
Output
If the date is December 25, output:
Merry Christmas!

If the date is December 31  or January 1, output:
Have a Happy New Year!

If the date is between December 25 and December 31 (exclusive), output:
Happy Holdidays!

If the date is December 24, output:
1 day until Christmas!

If the date is before December 24, output:
x days until Christmas!

Where x is replaced with the numbers of days until Christmas Day. Beware of leap years :)
Input
If your language does not have a builtin function to return the current date, you may have a time stamp passed as input to the program.
Examples
> Dec 25 2015
Merry Christmas!
> Jan 1 2016
Have a Happy New Year!
> Dec 24 2015
1 day until Christmas!
> Jan 2 2016
358 days until Christmas!
> Jan 2 2017
357 days until Christmas!

Winning:
Since your program might be delivered by Santa next year, you need to make the program as small as possible so as many programs as possible can fit into his sack.


text:
Adding Semicolons
Objective
Write the shortest program possible that adds semicolons to the end of all lines of code in a file unless:

it already has a semicolon at the end
the line is blank.

Must be a complete program.
Bonuses
Write the program so it won't produce any compiler errors when running the program on a C Header File.

for(;;)\n{\n/*whatever*/\n} is going to produce some unexpected results :P

You can do some crazy things in C (especially with the help of the PP). To require it to work on any C header is a scope way beyond reasonable.

You say that the C Header File part is a bonus, but you don't specify how many bytes we get off for it.

Your challenge itself seems fine, but the bonus part is a tad underspecified. In what situations exactly should we append a semicolon to get the bonus? What is that bonus worth?

My recommendation is that you just take out that bonus part -- it'll be very difficult to specify it clearly and even then I suspect the only sane solution for the bonus part would be to just apply semicolons, compile and remove semi-colons until it doesn't break...

Retina, 12 bytes
m`[^;¶]$
$0;

Try it online!
How it works
m`        Activate multi-line mode.
  [^;¶]   Match any character but a semicolon or a linefeed...
       $  followed by the end of the line.
$0        Replace the match with itself...
  ;       followed by a semicolon.

I count 13 bytes and 12 characters (¶ is two bytes)

@Loovjo In UTF-8, yes. ISO 8559-1 encodes ¶ as 0xB6.

Do we have a standard on encoding btw?

@Loovjo Sort of.

Perl, 19 15 14 bytes
s/[^;]$/$&;/

Try this fiddle online or this test suite.
Must be run with the -pl flags; this is accounted for in the score.
Thanks to @manatwork for -4 bytes.

With one more option, the -l, can be reduced to s/[^;]$/$&;/g.

Ooh, thanks! I forgot about that option.

JavaScript ES6, 69 bytes

alert(prompt().split`\\n`.map(x=>x.match(/;$|^$/g)?x:x+';').join`\n`)

In the input, separate the newlines by \n, e.g. some;\ncode\nthere

@man it doesn't seem to work properly... Though nice idea.


text:
Is it an integer, a string, or a decimal?
Your challenge is to determine whether the given input is an integer, a string, or a decimal.
Rules

A string is any input that is not an integer or a float
An integer must contain only numeric characters and must not start with a zero
A decimal is any input that contains the period (.) and the period is surrounded by numeric characters.

Note: .01 is not considered a valid decimal.

The program should output a raw string either "string", "integer", or "decimal".
You may assume only printable ASCII characters are used

Cases:
asdf -> string
asdf3.4 -> string
2 -> integer
2.0 -> decimal
02 -> string
40. -> string
. -> string
.01 -> string
0.0 -> decimal
.9.9.9 -> string
[empty space] -> string

EDIT: Fixed the typo. I meant .01 without the leading zero, not with. If that made it unclear, its fixed now!
This is code-golf, so shortest answer wins.

Why is 02 not an integer? These just feel like arbitrary restrictions in order to increase challenge difficulty.

I think 02 isn't considered an integer because most languages trim leading zeros when the type is an integer but keep leading zeros when it is stored as a string. Although, I'm with @isaacg that if 0.0 is considered a decimal, then 0.01 should be too. .01 not counting makes sense, I guess...

@Zequ .01 not counting makes sense, I guess... - why? It's valid in almost every language.

@mınxomaτ, sorry, I meant by his rules, not counting .01 makes sense. He defines a decimal as any input that contains the period surrounded by numeric characters. In .01, the period is not surrounded by numeric characters.

Welcome to Programming Puzzles & Code Golf! There's no need to unnecessarily ping everyone who's commented on your question; your edit automatically puts your question into the reopen queue, where it will be reopened if necessary. Furthermore, many of your challenges seem to have been closed; you might want to try running them through our Sandbox first. Thanks!

@CrazyPython I think the idea you're getting at with "valid integer" and "valid decimal" is the idea of a canonical representation. As I understand your rules, there's exactly one way to write each integer and each decimal. If that's the intent, adding that to the challenge will clarify why the rules are the way they are.

Test cases: 00.00, 02.0

Are capitalized answers acceptable?: "String", "Integer", "Decimal"?

@DavidC Strictly? No.

I guess that '0.0.0' is not a valid decimal, but it could be according to the rules. I contains the period sourrounded by numeric characters

Some of the answers seem to assume that the input is always provided as a string. Is that correct?

@murphy Yep, pretty much.

How is 02 a string? Obviously it's an integer.

@nicael see the comments by CrazyPython and Zequ. See also the test cases proposed by Martin. If it has to be a "canonical representation" they also should give "string"

Pyth, 33 bytes (39 without packed string)
@_c."at%¸Ã`9hàãáÊ"7.x/`MsB+vz0z0

Some bytes are stripped due to Markdown. Official code and test suite.
Without packed string:
@_c"integerdecimalstring"7.x/`MsB+vz0z0

It passes all of above test cases. Basically, to check if a string is a integer or decimal, it checks whether the string can be evaluated as a python literal (v), and if so, if you can add 0 to it and covert it back to its string representation, and get the input string. If so, it's an integer or a decimal. If you can also cast it to an int and still get the original string back, it's an integer.

Javascript, 112 121 87 bytes
Thanks to @edc65 for saving 34 bytes by converting the original code (in the explanation) to ES6. I didn't change the explanation because it shows the logic better.
b=a=>/^[1-9]\d*$/.test(a)?"integer":/^([1-9]\d+|\d)\.\d+$/.test(a)?"decimal":"string"

This basically converts the rules for an integer and decimal in the question into regex checks, and tests them against the given input. If the input doesn't match, then it must be a string. It passes all of the tests given in the question.
Ungolfed + explanation
function b(a) {
    if(/^[1-9]\d*$/.test(a)) // regex check for the rules of an 'integer':
        return"integer";     // ^[1-9] - check to make sure the first digit
                             // \d* - check to make sure that it is followed by zero or more digits
                             // $ - ensures that the previous check continues to the end of the word
    if(/^([1-9]\d+|\d)\.\d+$/.test(a)) // regex check for the rules of a 'decimal', starting from the middle
        return"decimal";     // \. checks for a '.' in the word
                             // the ([1-9]\d+|\d) and \d+ check to make sure the '.' is surrounded by
                             // one or more numerical characters on each side.
                             // the ^,$ ensure that the match is for the whole word
return"string";              // none of the others match, so it must be a string.

}

This seems to fail on inputs such as 01.23.

I fixed it, it passes the b("0.123") case. Sorry about that, since it was only  explicitly mentioned in the question that an integer couldn't have leading zeros, I assumed it didn't apply to decimals.

Shortened to ES6 is 83 a=>/^[1-9]\d*$/.test(a)?"integer":/^([1-9]\d+|\d)\.\d+$/.test(a)?"decimal":"string" ... not the shortest possible anyway

Thank you, I updated the code, I had to add b= for it to work in Chrome. For me, it shows the original one you posted to be 85 bytes, instead of 83, plus the 2 bytes for a total of 87.

@Zequ usually assigning the function to a variable (b=) is not counted. And the rest is 83, beware of strange invisible characters inserted by the comment editor - there is some in my previous comment between "str" and "ing"

Java, 133 bytes
String t(String v){if(v.matches("[1-9]\\d*"))return "integer";if(v.matches("(0|[1-9]\\d+)\\.\\d+"))return "decimal";return "string";}

Perl 5, 59 bytes
With the -p argument on the command line (which is calculated into the byte count):
chop;$_=!/\D|^0/?"integer":/^\d+\.\d+$/?"decimal":"string"

Fails for any 00.nn (try 00.00)

Fixed. Though perhaps that should be in the test cases given.

It should. On the other hand, often the test cases do not cover all the possible cases.

Still wrong, now it gives 'integer' for input .0. What is the chop for?

Fixed. Lost interest in this challenge. Not sure if I could've optimized this fix or not. Chop was necessary in a previous iteration of the script. It didn't like the newline from user input.

Now it gives string for input 0.0Oh well, it's just for fun

@edc65 ;_; Fixed. You make my regexes cry. Had to put the chop back in, but this entire thing actually brought my byte count down by 1 anyway it turns out. Thanks.

Still string for input 0.0 http://ideone.com/KRWmbb

JavaScript (ES6), 74 75
Edit 1 byte saved thx Zequ
f=i=>(i=i.match(/^(0|[1-9]\d*)(\.\d+)?$/))?i[2]?'decimal':'integer':'string'

Test

f=i=>(i=i.match(/^(0|[1-9]\d*)(\.\d+)?$/))?i[2]?'decimal':'integer':'string'

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

// test cases from the question and some more
s=['asdf','asdf3.4','02','40.','.','.01','.9.9.9','','0.0.0','00.00','02.00']
i=['2', '11', '1000']
d=['2.0','0.0', '1.009', '911.1','123.4567890']

console.log('Strings:')
s.forEach(x=>console.log('<'+x+'> -> '+f(x)))
console.log('Integers:')
i.forEach(x=>console.log('<'+x+'> -> '+f(x)))
console.log('Decimals:')
d.forEach(x=>console.log('<'+x+'> -> '+f(x)))

You could save a byte by changing [^0\D] in the regex match to [1-9]

@Zequ good hint, thanks ... using a compound range seemed so clever :(

Perl 6, 61 bytes
{<string integer decimal>[?/^[(\d+\.\d+)|<[1..9]>\d*]$/+?$0]} # 61

Usage:
say «asdf asdf3.4 2 2.0 02 40. . .01 0.0 .9.9.9 ''».map: {...}

(string string integer decimal string string string string decimal string string)

Python 2, 148 bytes
def f(s):
 try:
  t=float(s);assert s[0]!='0'
  if `t+0`==s:return'decimal'
  if `int(t)`==s:return'integer'
  return'string'
 except:return'string'

assert f('asdf') == 'string'
assert f('asdf3.4') == 'string'
assert f('2') == 'integer'
assert f('2.0') == 'decimal'
assert f('.') == 'string'
assert f('.01') == 'string'
assert f('.9.9.9') == 'string'
assert f(' ') == 'string'
assert f('40.') == 'string'
assert f('02') == 'string'
assert f('0.0') == 'string'
assert f('00.00') == 'string'

JavaScript ES6, 74 70 bytes
w=>w.match(/^\d+\.\d+$/)?"decimal":w.match(/^\d+$/)?"integer":"string"

it fails with the test cases from the question. Really, please, test before posting.

@edc Thanks for the feedback, though could you please tell me what cases do fail except 02?

Glad that you find it by yourself

Have a look at my answer for a fiddle.

It should work with the test cases if you changed /^\d+$/ to ^[1-9]\d* (75 bytes).


text:
Counting Fountains
A fountain is arrangement of coins in rows so that each coin touches two coins in the row below it, or is in the bottom row, and the bottom row is connected. Here's a 21 coin fountain:

Your challenge is to count how many different fountains can be made with a given number of coins.
You will be given as input a positive integer n. You must output the number of different n-coin fountains that exist.
Standard I/O rules, standard loopholes banned. Solutions should be able to calculate n = 10 in under a minute.

Desired output for n = 1 ... 10:
1, 1, 2, 3, 5, 9, 15, 26, 45, 78

This sequence is OEIS A005169.

This is code golf. Fewest bytes wins.

Is there an n for which the program must be guaranteed to work? (i.e. after which it may break)

@quintopia It should work for all n, up to limitations of datatype, hardware, etc.

Python, 57 bytes
f=lambda n,i=0:sum(f(n-j,j)for j in range(1,i+2)[:n])or 1

As observed on OEIS, if you shift each row half a step relative to the row below it, the column sizes form a sequence of positive integers with a maximum upward step of 1.
The function f(n,i) counts the sequences with sum n and last number i. These can be recursively summed for each choice of the next column size from 1 to i+1, which is range(1,i+2). Truncating to range(1,i+2)[:n] prevents columns from using more coins than remain, avoiding needing to say that negative n's give 0. Moreover, it avoids an explicit base case, since the empty sum is 0 and doesn't recurse, but f(0) needs to be set to 1 instead, for which or 1 suffices (as would +0**n).

17 bytes in Pyth: M|sgL-Gd<ShHG1gQ0

Mathematica, 59 bytes
SeriesCoefficient[1-Fold[1-x^#2/#&,Range[#,0,-1]],{x,0,#}]&

Based on the Mathematica program on OEIS by Jean-François Alcover.

Can you rewrite this as a formula (I just want to compare with the formula I found)? I just cannot read Mathematica=)

@flawr The generating function of the sequence is 1/(1-x/(1-x^2/(1-x^3/(1-x^4/(1-x^5/(...)))))).

Thanks for the explanation, that is indeed a nice approach if you have such a powerfull CAS=)

Haskell, 60 48 bytes
Thanks to @nimi for providing a way shorter solution!
n#p|p>n=0|p<n=sum$map((n-p)#)[1..p+1]|1<2=1
(#1)

Old version.
t n p|p>n=0|p==n=1|p<n=sum[t (n-q) q|q<-[1..p+1]]
s n=t n 1

The function calculating the value is s, implementation of the recursive formula found here: https://oeis.org/A005169

A bug: the recursive call is t (n-p) q. Golfing tips: use an infix operator for t, swap the guards and use map instead of the list comprehension: n#p|p>n=0|p<n=sum$map((n-p)#)[1..p+1]|1<2=1. s becomes s=(#1), but  you don't have to give the main function a name at all, so (#1) is enough. 48 bytes.

Thanks you very much for the hints! I just started learning the basics of Haskell. I'm going to have to learn about that how the usage of # and $ here first=)

A little bit of explanation:  # is a user defined infix function just like +, *, etc. are predefined infix functions. $ is another way to adjust precedence (besides parentheses) f (g (h x))-> f$g$h x or in our case sum(map(...)[...]) -> sum$map(...)[...].

Thank you, that is quite useful to know, I appreciate your explanation!

Pyth, 21 20 bytes
Ms?>GHgL-GHShHqGHgQ1

Try it online. Test suite.
This is a direct implementation of the recursive formula on the OEIS page, like the Matlab answer.

Haskell, 43 bytes
n%i=sum[(n-j)%j|j<-take n[1..i+1]]+0^n
(%0)

See Python answer for explanation.
Same length with min rather than take:
n%i=sum[(n-j)%j|j<-[1..min(i+1)n]]+0^n
(%0)

Matlab, 115 105 bytes
function F=t(n,varargin);p=1;if nargin>1;p=varargin{1};end;F=p==n;if p<n;for q=1:p+1;F=F+t(n-p,q);end;end

Implementation of the recursive formula found here: https://oeis.org/A005169
function F=t(n,varargin);
p=1;
if nargin>1
    p=varargin{1};
end;
F=p==n;
if p<n;
    for q=1:p+1;
        F=F+t(n-p,q);
    end;
end;

Julia, 44 43 bytes
f(a,b=1)=a>b?sum(i->f(a-b,i),1:b+1):1(a==b)

This uses recursive formula on OEIS.
Explanation
function f(a, b=1)
    if a > b
        # Sum of recursing
        sum(i -> f(a-b, i), 1:b+1)
    else
        # Convert bool to integer
        1 * (a == b)
    end
end

Has anyone else noticed that strike through 44 is regular 44??

Python 3, 88 bytes
f=lambda n,p:sum([f(n-p,q)for q in range(1,p+2)])if p<n else int(p==n)
t=lambda n:f(n,1)

JavaScript (ES6), 63
Implementing the recursive formula at OEIS page
F=(n,p=1,t=0,q=0)=>p<n?eval("for(;q++<=p;)t+=F(n-p,q)"):p>n?0:1

APL, 26 bytes
{⍵≥⍺:⍵=⍺⋄+/(⍺-⍵)∘∇¨⍳⍵+1}∘1

Straightforward implementation of the first formula from the sequence explanation page. Honestly, I didn't understand anything, so let's check the results:
      {⍵≥⍺:⍵=⍺⋄+/(⍺-⍵)∘∇¨⍳⍵+1}∘1¨⍳10
1 1 2 3 5 9 15 26 45 78