Skip to content

Instantly share code, notes, and snippets.

@bholmberg
bholmberg / cornify.directive.js
Created March 25, 2013 16:34
AngularJS directive to cornify a web page when the "konami code" entered on the keyboard. I wrapped js I found on a blog into a DDO.
ngApp.directive("cornify", function () {
return {
link: function (scope, element, attrs) {
var konami_keys = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65];
var konami_index = 0;
$(document).keydown(function(e){
if (e.keyCode === konami_keys[konami_index++]) {
if (konami_index === konami_keys.length) {
$(document).unbind('keydown', arguments.callee);
$.getScript('http://www.cornify.com/js/cornify.js',function(){