-
-
Save nicolocarpignoli/f4678ef87615b2ff967bc694543ed6fe to your computer and use it in GitHub Desktop.
DNAfy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <title></title> | |
| <style> | |
| body { | |
| background: white; | |
| text-align: center; | |
| padding: 20px; | |
| font-family: Georgia, serif; | |
| font-weight: bold; | |
| font-style: italic; | |
| color: #999; | |
| } | |
| a { | |
| color: #99f; | |
| } | |
| h1 { | |
| font-size: 16px; | |
| } | |
| h2 { | |
| font-size: 12px; | |
| } | |
| #word { | |
| font-size: 36px; | |
| color: black; | |
| } | |
| button { | |
| font-size: 24px; | |
| padding: 10px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Random DNA components class names</h1> | |
| <p id="word"></p> | |
| <button id="enterprise">DNAfy!</button> | |
| <button id="again">Again</button> | |
| <br /><br /><br /> | |
| <a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="huskyr">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> | |
| <br /><br /><br /> | |
| <small><a href="https://gist.github.com/1351230">Fork this gist on Github to add your own words ;)</a></small> | |
| <script> | |
| var words = [ | |
| "BE", "DNA", "Ieb", "Iq", | |
| ], | |
| inWords = [ | |
| "Switch", "Embed", "Mixin", "Broker", "Helper", "Factory", "Component", "Store", "Model", "App", "Proxy", "Observable", "Event", "Base", "Mock", "Test", | |
| ]; | |
| function $(id) { | |
| return document.getElementById(id); | |
| } | |
| function rand(min, max) { | |
| return Math.round(Math.random() * (max - min)) + min; | |
| } | |
| function generate(min, max) { | |
| var allWords = words.concat( inWords ), | |
| word = ''; | |
| for (var i = 0, l = rand(min, max) - 1; i < l; i++) { | |
| do { | |
| var w = allWords[ rand(0, allWords.length - 1) ]; | |
| } while (word.indexOf(w) !== -1); | |
| word += w; | |
| } | |
| word += words[ rand(0, words.length) ]; | |
| return word; | |
| } | |
| $("again").onclick = function() { | |
| $("word").innerHTML = generate(2, 3); | |
| $("enterprise").innerHTML = "Enterprisify!"; | |
| } | |
| $("enterprise").onclick = function() { | |
| var word = $("word").innerHTML; | |
| $("word").innerHTML = generate(1, 1) + word; | |
| $("enterprise").innerHTML = "Enterprisify even more!"; | |
| } | |
| $("word").innerHTML = generate(2, 3); | |
| </script> | |
| <script type="text/javascript"> | |
| var _gaq = _gaq || []; | |
| _gaq.push(['_setAccount', 'UA-15405780-12']); | |
| _gaq.push(['_trackPageview']); | |
| (function() { | |
| var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
| ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
| var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
| })(); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment