Skip to content

Instantly share code, notes, and snippets.

View ralphholzmann's full-sized avatar

Ralph Holzmann ralphholzmann

View GitHub Profile
(function ($) {
var keys = [], code = '38,38,40,40,37,39,37,39,66,65';
var konami = function (e) {
keys.push(e.which);
if (keys.length >= 11 && keys.slice(-11).toString() !== code) {
keys = [];
/* do your konami thing here */
} else if (keys.length > 11) {
keys.length = 11;
}
<script>
// Load browser shims
Modernizr.load([
{
test: window.JSON,
nope: 'libs/shims/json3.js'
},
{
test: Object.getOwnPropertyNames,
nope: "libs/shims/es5-shim.js",
@ralphholzmann
ralphholzmann / gist:1872549
Created February 21, 2012 00:29 — forked from rmurphey/gist:1329222
New computer setup notes
success: function(data){
setTimeout(function(){
_.each( data.objects, function( obj ) {
var t = new Todo({
id: data.obj.id,
text: data.obj.text,
done: data.obj.done,
order: data.obj.order
});
@ralphholzmann
ralphholzmann / gist:1038554
Created June 21, 2011 18:42 — forked from garann/gist:1038401
Challenge Accepted.
getEl = (function (doc) {
var getElementsByClassName = (function () {
return doc.getElementsByClassName ?
function (selector) {
return doc.getElementsByClassName(selector.split('.').pop());
} : function (selector) {
var parts = selector.split("."),
/**
* Yepnope JS
*
* Version 0.2.6pre
*
* by Alex Sexton - AlexSexton@gmail.com
*
* Tri-Licensed WTFPL, BSD, & MIT
*/
(function(window, doc, undef) {
(function($){
function domchanged(methods, type) {
$.each( methods.split(' '), function( i, method ) {
// Store a reference to the original method.
var orig = $.fn[ method ];
// Override the original method.
$.fn[ method ] = function(){
var args = arguments,
// Rough implementation, untested, etc
// Will obviously fail when non-overridden methods are used to change the DOM
(function($){
$.fn.isAncestorOf = function( elem ) {
// If parent and child element are the same, return false
if (this[0] == elem[0]) return false;