Skip to content

Commit

Permalink
tidy up docs & whitespace, declare firstSentences var, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoef committed Jan 5, 2016
1 parent 3ffd196 commit 5b1a81d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
10 changes: 7 additions & 3 deletions README.md
@@ -1,10 +1,14 @@
rygo-ipsum
==========

ryan gosling lorem ipsum
Ryan Gosling lorem ipsum, featured on [Meet The Ipsums](http://meettheipsums.com/)!

http://www.rygo-ipsum.com/

Fire up a simple python server to get started!
### Development ###

`python -m SimpleHTTPServer 3000`
Clone or fork this repo, fire up a server from the project directory,

`$ python -m SimpleHTTPServer 3000`

and head to http://localhost:3000 (or whatever port you choose for your server) to get started!
3 changes: 1 addition & 2 deletions index.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html>

<head>

<meta charset="utf-8">
Expand Down Expand Up @@ -40,7 +41,6 @@ <h3>ryan gosling lorem ipsum</h3>
<li class="medium">medium</li>
<li class="long">long</li>
</ul>

</header>

<section class="text"></section>
Expand All @@ -57,7 +57,6 @@ <h3>ryan gosling lorem ipsum</h3>
</section>
</script>


</body>

</html>
10 changes: 6 additions & 4 deletions js/site.js
Expand Up @@ -11,7 +11,7 @@ $(document).ready(function() {
}

/**
* Create a multi-dimensional array of random ipsum text. Its length is determined
* Create a multi-dimensional array of random ipsum text. Length is determined
* by the value of the paragraph & sentence params
* @param {number} paragraphCount - number of paragraphs generated
* @param {number} sentenceCount - number of sentences generated in each paragraph
Expand All @@ -20,10 +20,11 @@ $(document).ready(function() {
$.getJSON('sentences.json',
function(data) {
var sentenceArr = _.shuffle(data);
var firstSentences = [];
var paragraphArr = [];

for (var p=0; p < paragraphCount; p++) {
var firstSentences = _.first(sentenceArr, sentenceCount);
firstSentences = _.first(sentenceArr, sentenceCount);
paragraphArr.push(firstSentences);
sentenceArr = _.rest(sentenceArr, sentenceCount);
}
Expand All @@ -33,8 +34,8 @@ $(document).ready(function() {
}

/**
* Create markup based on data from the ipsum array
* @param {Array} ipsum - multi-dimensional array of paragraphs -> sentences
* Create and insert markup based on data from the ipsum array
* @param {Array} ipsum - multi-dimensional array of paragraphs, sentences
*/
function generateTemplate(ipsum) {
var templateString = $('.template').html();
Expand All @@ -59,4 +60,5 @@ $(document).ready(function() {
toggleIpsum('.short', 1, 8);
toggleIpsum('.medium', 3, 5);
toggleIpsum('.long', 5, 5);

});

0 comments on commit 5b1a81d

Please sign in to comment.