├── .gitignore ├── code-snippets ├── randomize-from-array.js ├── shuffle.js └── typer │ ├── typer_char │ ├── index.html │ ├── js │ │ ├── init.js │ │ └── jquery-3.2.0.min.js │ └── style.css │ └── typer_word │ ├── index.html │ ├── js │ ├── init.js │ └── jquery-3.2.0.min.js │ └── style.css ├── project-template ├── _assets │ ├── scripts.js │ └── styles.css └── index.html └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | example 2 | demo 3 | -------------------------------------------------------------------------------- /code-snippets/randomize-from-array.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | 3 | console.log('randomizer ready!'); 4 | 5 | var ourArray = ["Blue", "Green", "Orange", "Picasso", "Matisse", "Gaugin"]; 6 | // console.log('ourArray: ' + ourArray); 7 | 8 | var item = ourArray[2]; 9 | // console.log("item: " + item); 10 | 11 | var length = ourArray.length; 12 | // console.log(length); 13 | // console.log(Math.random()); 14 | 15 | var rand = ourArray[Math.floor(Math.random() * ourArray.length)]; 16 | // console.log('rand: ' + rand); 17 | 18 | function shuffle(array) { 19 | var currentIndex = array.length, 20 | temporaryValue, 21 | randomIndex; 22 | 23 | // While there remain elements to shuffle... 24 | while (0 !== currentIndex) { 25 | // Pick a remaining element... 26 | randomIndex = Math.floor(Math.random() * currentIndex); 27 | currentIndex -= 1; 28 | 29 | // And swap it with the current element. 30 | temporaryValue = array[currentIndex]; 31 | array[currentIndex] = array[randomIndex]; 32 | array[randomIndex] = temporaryValue; 33 | } 34 | return array; 35 | } 36 | 37 | shuffle(ourArray); 38 | console.log("shuffle: " + ourArray); 39 | 40 | var myList = ourArray.slice(0, 1); 41 | console.log("first two: " + myList); 42 | 43 | $(".result").append(myList); 44 | 45 | }); 46 | -------------------------------------------------------------------------------- /code-snippets/shuffle.js: -------------------------------------------------------------------------------- 1 | function shuffle(array) { 2 | var currentIndex = array.length, temporaryValue, randomIndex; 3 | 4 | // While there remain elements to shuffle... 5 | while (0 !== currentIndex) { 6 | 7 | // Pick a remaining element... 8 | randomIndex = Math.floor(Math.random() * currentIndex); 9 | currentIndex -= 1; 10 | 11 | // And swap it with the current element. 12 | temporaryValue = array[currentIndex]; 13 | array[currentIndex] = array[randomIndex]; 14 | array[randomIndex] = temporaryValue; 15 | } 16 | 17 | return array; 18 | } 19 | 20 | // run function 21 | // change ourArray to the variable name of YOUR ARRAY 22 | shuffle(ourArray); 23 | -------------------------------------------------------------------------------- /code-snippets/typer/typer_char/index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |