Skip to content

Instantly share code, notes, and snippets.

@fuddl
Created March 11, 2015 13:09
Show Gist options
  • Save fuddl/5cfbaafe2fbbd2cd8e40 to your computer and use it in GitHub Desktop.
Save fuddl/5cfbaafe2fbbd2cd8e40 to your computer and use it in GitHub Desktop.
deterministic lipsum mixin in jade. Does not create any 'random' text
- var loremCount = 0;
mixin lipsum(amount)
- var loremText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
- var lipsumArray = loremText.split(' ');
- var loremIpsum = '';
- var wordCount = lipsumArray.length
- for (var i = 0; i < amount; i++) {
- if(i > 0) {
- loremIpsum += ' ';
- }
- loremIpsum += lipsumArray[(i+loremCount)%wordCount];
- }
- loremCount += 1;
- loremIpsum = loremIpsum.charAt(0).toUpperCase() + loremIpsum.slice(1);
=loremIpsum
block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment