Skip to content

Instantly share code, notes, and snippets.

@shirokoweb
Created January 13, 2018 11:35
Show Gist options
  • Save shirokoweb/d6056275731ddd0d955c18d75a8df8b3 to your computer and use it in GitHub Desktop.
Save shirokoweb/d6056275731ddd0d955c18d75a8df8b3 to your computer and use it in GitHub Desktop.
// utilities
var get = function (selector, scope) {
scope = scope ? scope : document;
return scope.querySelector(selector);
};
var getAll = function (selector, scope) {
scope = scope ? scope : document;
return scope.querySelectorAll(selector);
};
// setup typewriter effect in the terminal demo
if (document.getElementsByClassName('demo').length > 0) {
var i = 0;
var txt = `scribbler
[Entry mode; press Ctrl+D to save and quit; press Ctrl+C to quit without saving]
###todo for new year dinner party
- milk
- butter
- green onion
- lots and lots of kiwis 🥝`;
var speed = 60;
function typeItOut () {
if (i < txt.length) {
document.getElementsByClassName('demo')[0].innerHTML += txt.charAt(i);
i++;
setTimeout(typeItOut, speed);
}
}
setTimeout(typeItOut, 1800);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment