var IndexPage = {
    numToShow: 5,
    loadQuotes: function() {
        var quotes  = new Array();
        var authors = new Array();
        quotes[0]   = 'If programming in Ruby isn\'t fun, you\'re doing it wrong.';
        authors[0]  = 'Miles Forrest';
        quotes[1]   = 'I\'ve always felt I\'d be more comfortable with the Law of Demeter if it were called the Suggestion of Demeter.';
        authors[1]  = 'Martin Fowler';
        quotes[2]   = 'I made up the term object-oriented and I can tell you, I did not have C++ in mind.';
        authors[2]  = 'Alan Kay';
        quotes[3]   = 'Java: It\'s the blunt scissors of programming languages.';
        authors[3]  = 'Dave Thomas';
        quotes[4]   = 'Languages don\'t teach design. You can make a mess in any language.';
        authors[4]  = 'Robert Martin';
        quotes[5]   = 'People seem to love things which could do anything, but hate them by the time it does everything.';
        authors[5]  = 'Joseph Hirn';
        quotes[6]   = 'User confusion is a real bug.';
        authors[6]  = 'Yehuda Katz';
        quotes[7]   = 'The true sign of expertise is that the more you learn, the less you feel like an expert. Or at least I hope it is.';
        authors[7]  = 'Martin Fowler';
        quotes[8]   = 'I well remember when this realization first came on me with full force... that a good part of the remainder of my life was going to be spent in finding errors in my own programs.';
        authors[8]  = 'Maurice Wilkes';
        quotes[9]   = 'One cannot help being struck by the power of the computer to bind together, in a genuine community of interest, people whose motivations differ widely.';
        authors[9]  = 'Maurice Wilkes';
        quotes[10]  = 'The road to hell is paved with not going back to refactor your crap once you got your code working.';
        authors[10] = 'Dave Brady';
        quotes[11]  = 'The customer does not know what he wants until you don\'t give it to him.';
        authors[11] = 'Dave Brady';
        quotes[12]  = 'Eventually you\'ll forget that you used to spend hours testing your code in a browser, and start complaining that your automated tests are taking minutes to run!';
        authors[12] = 'Josh French';
        quotes[13]  = 'She swore while debugging "...for it is damnably troublesome work, and plagues me."';
        authors[13] = 'Ada Lovelace';
        quotes[14]  = 'Atwood\'s Law: any application that can be written in JavaScript, will eventually be written in JavaScript.';
        authors[14] = 'Jeff Atwood';
        quotes[15]  = 'In 35 years we have gone from 80 col punch cards to 140 char Tweets, a compound annual increase of 1.4%.';
        authors[15] = 'Mitch Kapor';
        quotes[16]  = '100% code coverage means nothing, but less than 100% code coverage means something.';
        authors[16] = 'Jeremy Evans';
        quotes[17]  = 'It is far more important for someone to understand why you are doing something than how you are doing something. There are many ways to do something, but there is only one intent.';
        authors[17] = 'John Nunemaker';
        quotes[18]  = 'Response time is very important. Of course it is. But superior user experience design will trump negligible performance optimizations every day of the week.';
        authors[18] = 'Garry Tan';
        quotes[19]  = 'Programming isn\'t about what you know; it\'s about what you can figure out.';
        authors[19] = 'Chris Pine';
        quotes[20]  = 'What people really want is a high-quality system that implements everything they want, at no cost, right now. Everything else is a trade-off.';
        authors[20] = 'Watts Humphrey';
        quotes[21]  = 'Cut and paste is the root of all evil.';
        authors[21] = 'Noel Rappin';
        quotes[22]  = 'It\'s not always easy to tell whether an idea is a gross hack or a clever simplification.';
        authors[22] = 'Brian Marick';
        quotes[23]  = 'A phrase that gives me great confidence--"the process was discovered rather than designed"';
        authors[23] = 'Kent Beck';
        quotes[24]  = 'Building a startup to get bought is like going to college to get your M.R.S. degree.';
        authors[24] = 'Amy Hoy';
        quotes[25]  = 'You can\'t use a thing without feeling emotions about it - hopefully pleasure. That cannot be mass-engineered by split-testing.';
        authors[25] = 'Amy Hoy';
        quotes[26]  = 'Internet marketing is a communications contest, not a design competition.';
        authors[26] = 'Ian Lurie';
        quotes[27]  = '\"If it doesn\'t exist, it can\'t break.\" A great argument for mitigating unnecessary complexity.';
        authors[27] = '@flrsh10'; 
        quotes[28]  = 'Life was simple before World War II. After that, we had systems.';
        authors[28] = 'Grace Hopper'; 
        quotes[29]  = 'These Functional Equations are complete Will-o-the-Wisps to me. The moment I fancy I have really at last got hold of something tangible and substantial, it all receded further and further and vanishes again into thin air...';
        authors[29] = 'Ada Lovelace';       
        quotes[30]  = 'Fork: It\'s the modern copy and paste.';
        authors[30] = 'Jim Weirich';      
        quotes[31]  = 'TDD is a great way to sneak up on a solution, but sometimes you have no problem staring a solution right in the face.';
        authors[31] = 'Michael Feathers';      
        quotes[32]  = '10,000 details right with the new UI, only 990,000 to go... implementing ui\'s is an act of faith that you\'ll ever get it good enough.';
        authors[32] = 'Kent Beck';      
        quotes[33]  = 'When I have too much time on my hands the comic becomes more of a \'job\' and loses the all-important feeling of skiving off that is so essential to creativity.';
        authors[33] = 'Sydney Padua';        
        quotes[34]  = 'PostgreSQL is free, but it\'s ten bucks for this app that makes it snow on my desktop.';
        authors[34] = 'Frederick Polgardy';        
        quotes[35]  = 'A cloud computer is just like a regular computer, except you have to ask permission from the phone company every time you use it.';
        authors[35] = 'Cory Doctorow';
        quotes[36]  = 'On the seventh day God rested. We know that. On days one to six he iterated... Don\'t try to perfect it. Just get it out there and iterate.';
        authors[36] = 'Jay Rosen';

        quotes[37]  = 'Smalltalk is not only NOT its syntax or the class library, it is not even about classes. I\'m sorry that I long ago coined the term "objects" for this topic because it gets many people to focus on the lesser idea.  The big idea is "messaging".';
        authors[37] = 'Alan Kay';
        quotes[38]  = 'Computer programming is moments of triumph surrounded by hours of the computer telling you you\'re an idiot.';
        authors[38] = 'David Brown';
        quotes[39]  = 'It\'s a sign I don\'t understand the domain well enough that half of my test failures are errors in the tests.';
        authors[39] = 'Kent Beck';
        quotes[40]  = 'An example would be handy right about now.';
        authors[40] = 'Brian Marick';
        quotes[41]  = 'Move forward as soon as you\'re sure you\'ll learn something. Don\'t wait until you\'re sure you\'re right.';
        authors[41] = 'Kent Beck';
        quotes[42]  = 'Iterating only works if you can tell if you\'re getting hotter or colder with each attempt.';
        authors[42] = 'Jason Gorman';
        quotes[43]  = 'All software meant to be used daily must be usable without a mouse, including web apps. It\'s not optional.';
        authors[43] = 'Gary Bernhardt';
        quotes[44]  = 'Dance like nobody\'s watching. Love like you\'ve never been hurt. Develop software like the end user has your home address.';
        authors[44] = 'Robert Fischer';
        quotes[45]  = 'If the user can get around it, it\'s not security, it\'s reassurance. And being offended when someone circumvents it is useless.';
        authors[45] = 'Linda Goldstein';
        quotes[46]  = 'Don\'t try to learn Smalltalk by reading. That\'s passive data, accessing it is wrong! Find a Smalltalker and start exchanging messages.';
        authors[46] = 'Dave Brady';
        quotes[47]  = 'Estimation: in which you arrive at a terrifyingly large number which always winds up seeming optimistic in retrospect.';
        authors[47] = 'Avdi Grimm';
        quotes[48]  = 'Advice from pair programming: have strong opinions, hold them loosely.';
        authors[48] = 'John Fitzpatrick';
        quotes[49]  = 'Coding elegance is a lot like yard work - most of us do just enough to keep the neighbors happy.';
        authors[49] = 'Marc Peabody';
        quotes[50]  = 'Maybe the best programmers aren\'t those who spectacularly solve crazy problems, but those who don\'t create them, which is much more silent.';
        authors[50] = 'Lena Herrmann';
        quotes[51]  = 'If deploying after the first 10% of your project is done wouldn\'t teach you anything, you worked on the wrong 10%';
        authors[51] = 'Kent Beck';
        quotes[52]  = 'If too many users are wrong, it\'s probably your fault';
        authors[52] = 'rachelbythebay';
        quotes[53]  = '"Impaled on his own spike" is the software developer equivalent of "hoist by his own petard."';
        authors[53] = 'Mike Gunderloy';
        quotes[54]  = 'Willful, deliberate ignorance of the internals of other objects is at the core of OO design.';
        authors[54] = 'Sandi Metz';

        var count =  quotes.length;
        var toShow = new Array(count);
        var next = 0;
        while (next < count)
        {
            j = Math.floor(Math.random() * count);
            if ($.inArray(j, toShow) < 0)
            {
                toShow[next] = j;
                next++;
            }
        }     
        
        var str = '<h2>Quotes I like</h2>';
        for ( var i = 0; i < quotes.length; ++i) 
        {
            j = toShow[i];
            str = str + '<p class="quote">' + quotes[j] + '<span class="author">-' + authors[j] + '</span></p>';
        }
        return str;
    },
    init: function() {
        //add all quotes to page in random order
        $('#quoteString').html(IndexPage.loadQuotes());
        //show top numToShow
        for (var i = 0; i < IndexPage.numToShow; i++)
        {
            $('p:eq(' + i + ')', 'span#quoteString').show();
        }
    }
};
IndexPage.init();

