Daily Programming Challenge #3

Every day I am going to do a random programming challenge in Javascript.

Todays challenge:

Write a program that divides up some input text into sentences and then determines which sentence in the input has the most words. Print out the sentence with the most words and the number of words that are in it. Optionally, also print out all words in that sentence that are longer than 4 characters.
Sentences can end in periods, exclamation points and question marks, but not colons or semi-colons.
reddit

I remember doing something like this a while back. I tried to find my original code to compare but it seems lost forever.

Daily Programming Challenge #2

Every day I am going to do a random programming challenge in Javascript.

Todays challenge:

you have a string “ddaaiillyypprrooggrraammeerr”. We want to remove all the consecutive duplicates and put them in a separate string, which yields two separate instances of the string “dailyprogramer”.

use this list for testing:
input: “balloons”
expected output: “balons” “lo”
input: “ddaaiillyypprrooggrraammeerr”
expected output: “dailyprogramer” “dailyprogramer”
input: “aabbccddeded”
expected output: “abcdeded” “abcd”
input: “flabby aapples”
expected output: “flaby aples” “bap”
reddit

This one was too easy. Here’s my solution:

Daily Programming Challenge #1

Every day I am going to do a random programming challenge in Javascript.

Todays challenge:

Write a program that prints out the lyrics for “Ninety-nine bottles of beer”, “Old McDonald had a farm” or “12 days of Christmas”.

If you choose “Ninety-nine bottles of beer”, you need to spell out the number, not just write the digits down. It’s “Ninety-nine bottles of beer on the wall”, not “99 bottles of beer”!
For Old McDonald, you need to include at least 6 animals: a cow, a chicken, a turkey, a kangaroo, a T-Rex and an animal of your choosing (Old McDonald has a weird farm). The cow goes “moo”, the chicken goes “cluck”, the turkey goes “gobble”, the kangaroo goes “g’day mate” and the T-Rex goes “GAAAAARGH”. You can have more animals if you like.

Make your code shorter than the song it prints out!
reddit

I decided to go with the classic 99 bottles of beer on the wall. And below I present you with my solution:

Awesome App: Visits (Mac)

Visits is an awesome little utility shows you how many visits your site is getting. From the App Store:

See your site’s traffic without moving a finger. Visits allows you to, at a glance, see how your site is performing. Pulls all the important data from Google Analytics and gives you hour by hour breakdown of your traffic. In addition, it shows your top content, top referrals and search keywords for the day.

Buy now in the App Store.