Skip to content

Instantly share code, notes, and snippets.

@DmitryMyadzelets
Last active May 3, 2017 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DmitryMyadzelets/7c147beb1f5b2bb799776b6c6a83c784 to your computer and use it in GitHub Desktop.
Save DmitryMyadzelets/7c147beb1f5b2bb799776b6c6a83c784 to your computer and use it in GitHub Desktop.
Zodiac sign
{
"capricorn":"Capricorno",
"aquarius":"Acquario",
"pisces":"Pesci",
"aries":"Ariete",
"taurus":"Toro",
"gemini":"Gemelli",
"cancer":"Cancro",
"leo":"Leone",
"virgo":"Vergine",
"libra":"Bilancia",
"scorpio":"Scorpione",
"sagittarius":"Sagittario"
}
{
"capricorn":"Козерог",
"aquarius":"Водолей",
"pisces":"Рыбы",
"aries":"Овен",
"taurus":"Телец",
"gemini":"Близнецы",
"cancer":"Рак",
"leo":"Лев",
"virgo":"Девы",
"libra":"Весы",
"scorpio":"Скорпион",
"sagittarius":"Стрелец"
}
// Returns string of Zodiac sign given a day [1..31] and a month [0..11]
function zodiac(day, month) {
var sign = ['capricorn', 'aquarius', 'pisces', 'aries', 'taurus', 'gemini', 'cancer', 'leo', 'virgo', 'libra', 'scorpio', 'sagittarius'];
var last_day = [19, 18, 20, 20, 21, 21, 22, 22, 21, 22, 21, 20];
month += (day > last_day[month]);
month %= 12;
return sign[month];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment