Skip to content

Instantly share code, notes, and snippets.

@tcyrus
Last active August 29, 2015 14:16
Show Gist options
  • Save tcyrus/10fab20ce4622ee35545 to your computer and use it in GitHub Desktop.
Save tcyrus/10fab20ce4622ee35545 to your computer and use it in GitHub Desktop.
Dev Compliment Generator

Dev Compliment Generator

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="script.js"></script>
<link href="style.css" rel="stylesheet">
<title>Dev Compliment Generator</title>
</head>
<body>
<div class="container">
<h1>Dev Compliment Generator</h1>
<h2>
<input type="text" id="yourthing" placeholder="Your person here" size="15">
<span id="compliment">, Enter someone, fool.</span>
</h2>
<button id="another">Another!</button>
</div>
</body>
</html>
function getRandomInt(min, max) {
return Math.round(Math.random() * (max - min)) + min;
}
window.onload = function() {
compliment = document.getElementById('compliment');
var another = document.getElementById('another');
another.onclick = function(evt) {
var entry = document.getElementById("yourthing").value;
if (entry == "") {
compliment.textContent = ", Enter someone, fool.";
return;
}
var one = '';
var two = '';
switch (getRandomInt(1, 4)) {
case 1:
one = 'You have a beautiful';
switch (getRandomInt(1, 10)) {
case 1:
two = 'default search engine';
break;
case 2:
two = 'Gruntfile.js';
break;
case 3:
two = 'JS linter';
break;
case 4:
two = 'keyboard layout';
break;
case 5:
two = 'mailing list';
break;
case 6:
two = 'table layout';
break;
case 7:
two = 'CSS transition';
break;
case 8:
two = 'folder structure';
break;
case 9:
two = 'image minifier';
break;
case 10:
two = 'LAMP stack';
break;
}
break;
case 2:
one = "You're an incredible";
switch (getRandomInt(1, 10)) {
case 1:
two = 'Stack Overflow question asker';
break;
case 2:
two = 'HTML5 implementer';
break;
case 3:
two = 'Googler';
break;
case 4:
two = 'alt-tabber';
break;
case 5:
two = 'compiler';
break;
case 6:
two = 'node package manager';
break;
case 7:
two = 'single-serving app developer';
break;
case 8:
two = 'sarcasm bot ghostwriter';
break;
case 9:
two = 'indenter';
break;
case 10:
two = 'top 10 list generator';
break;
}
break;
case 3:
one = "You are a really strong";
switch (getRandomInt(1, 10)) {
case 1:
two = 'alt tabbist';
break;
case 2:
two = 'ironic tweetist';
break;
case 3:
two = 'email archiver';
break;
case 4:
two = 'meetup group participant';
break;
case 5:
two = 'soldering iron aficionado';
break;
case 6:
two = 'SEO (Search Engine Optimist)';
break;
case 7:
two = 'Spotify playlist generator';
break;
case 8:
two = 'random generator generator';
break;
case 9:
two = 'topical Twitter name inventor';
break;
case 10:
two = 'pull requestor';
break;
}
break;
case 4:
one = "You really have a way with";
switch (getRandomInt(1, 10)) {
case 1:
two = 'gender-neutral pronouns';
break;
case 2:
two = 'style inheritance';
break;
case 3:
two = 'perfectly-timed gifs';
break;
case 4:
two = 'microwave-adjacent selfies';
break;
case 5:
two = 'laptop sticker clustering';
break;
case 6:
two = 'unicode characters';
break;
case 7:
two = 'combining SVG icons';
break;
case 8:
two = 'naming conventions';
break;
case 9:
two = 'hacking Gibsons';
break;
case 10:
two = 'minimizing the number of server requests';
break;
}
break;
}
compliment.textContent = ", " + one + ' ' + two + '!';
};
}
@import url("http://fonts.googleapis.com/css?family=Roboto:700,100,500");
body {
background: #000;
color: #15EC82;
text-align: center;
font-size: 21px;
font-family: 'Roboto', sans-serif;
}
.container {
margin: 3em auto;
}
h1, h2 {
margin: 0;
}
h1 {
font-size: 40px;
font-weight: 500;
text-transform: uppercase;
}
h2 {
margin: 15px 0 25px;
font-size: 30px;
font-weight: 100;
}
h2 input {
background: none;
border: none;
border-bottom: dashed 3px #15EC82;
font-size: inherit;
color: inherit;
}
button {
background: #15ec82;
border-color: #15ec82;
border-top-color: #10c86d;
border-bottom-color: #0eac5e;
border-radius: 3px;
border-style: solid;
border-width: 1px 1px 2px;
color: #000;
cursor: pointer;
display: inline-block;
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
margin: 0;
outline: 0;
overflow: hidden;
padding: .4em .9em;
text-overflow: ellipsis;
text-decoration: none;
vertical-align: top;
white-space: nowrap;
appearance: none;
box-sizing: border-box;
}
button:active {
border-width: 2px 1px 1px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment