Skip to content

Instantly share code, notes, and snippets.

View digitarald's full-sized avatar
🏳️‍🌈

Harald Kirschner digitarald

🏳️‍🌈
View GitHub Profile
module Murray
class Router
class << self
attr_reader :mapping
def map &block
@mapping = []
instance_eval &block
self
end
Element.implement({
matchChild: function(selector){
return this.getElements(selector, true).contains(this);
}
});
myElement.match('div') // true
myElement.match('body div') // false
myElement.matchChild('div') // true
@digitarald
digitarald / SimplePlugin.js
Created April 15, 2009 13:22
Inline meta-data and build-information.
/*=
description: "Short details, one line or multi-line."
license: MIT # shorthand or url
author: "Harald Kirschner <mail@digitarald.de>" # array or single string
require: ["more:Element.Position", "more:Natives/*"] # filename, namespace:*, namespace[version]:folder/filename
provide: ["Assets/close-button.gif"] # more entities
*/
var SimplePlugin= new Class({ ...
/*
---
source: http://gist.github.com/133677
provides: document.write
description: MooTools based document.write replacement
requires: MooTools
author: Harald Kirschner -- digitarald.de
author: Thomas Aylott -- SubtleGradient.com
/*
---
source: http://gist.github.com/133677
provides: document.write
description: MooTools based document.write replacement
requires: MooTools
author: Harald Kirschner -- digitarald.de
author: Thomas Aylott -- SubtleGradient.com
/*
---
source: http://gist.github.com/133677
provides: document.write
description: MooTools based document.write replacement
requires: MooTools
author: Thomas Aylott -- SubtleGradient.com
thanks: Daniel Steigerwald -- daniel.steigerwald.cz
/*
---
source: http://gist.github.com/133677
provides: document.write
description: MooTools based document.write replacement
requires: MooTools
author: Thomas Aylott -- SubtleGradient.com
thanks: Daniel Steigerwald -- daniel.steigerwald.cz
/*
---
name: DomReady
description: Contains the custom event domready.
license: MIT-style license.
requires: [Browser, Element, Element.Event]
@digitarald
digitarald / Dragger.js
Created May 20, 2011 14:42
Dragger.js static events
Dragger.prototype = {
// Use touch for supported devices, rest with mouse
eventNames: ('ontouchstart' in window) ? {
start: 'touchstart',
move: 'touchmove',
stop: 'touchend'
} : {
start: 'mousedown',
move: 'mousemove',
@digitarald
digitarald / literal.js
Created May 25, 2011 10:21
Object Literal Notation in CS
var lost = {
loc : "Island",
get location () {
return this.loc;
},
set location(val) {
this.loc = val;
}
};
lost.location = "Another island";