Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<script>
function init () {
var el = document.getElementById ("textarea");
if (el.addEventListener) { // Firefox, Opera and Safari?
el.addEventListener('textInput', onTextInput, false); // Safari?
el.addEventListener('input', onTextInput, false); // FF?
el.addEventListener('propertychange', onTextInput, false);
}
var that = this; // this is a CarouselPane
this._focusable.on('beforeActivate', function(e) {
var toActivate = e.toActivateIndex; // index of the item that will become active
if (!that._inMotion) { // the CarouselPane wants to prevent move flooding
that.moveTo(toActivate, {callback: function() { // put the toActivate item in the spotlight
that._focusable.activateItem(toActivate); // now can manually activate the toActivate item
}});
}
glow.ready(function() {
var myAnimation = new glow.anim.css("#cycle", 5, {
"background-color": {from:"white", to:"black"}
});
myAnimation.start();
});
function f(key, val) {
return function(k) {
if (k === key) { return val; }
else return undefined;
};
};
var o = f(1, 2);
// what value does each alert?
alert(o(1));
(function (a) {
a.event.special.textchange = {
setup: function () {
a(this).bind("keyup", a.event.special.textchange.handler);
a(this).bind("cut paste input", a.event.special.textchange.delayedHandler)
}, teardown: function () {
a(this).unbind("keyup", a.event.special.textchange.keyuphandler);
a(this).unbind("cut", a.event.special.textchange.cuthandler)
}, handler: function () {
a.event.special.textchange.triggerIfChanged(a(this))
<!-- hypothetically...
All teams share a single loader tool. This loader will asynchronously pull in
one (or more) jquery versions and cache them.
-->
<script src="qLoader.js"></script>
<script type="text/javascript"> // Team 1
qLoader.load('jquery-1.3').then(function($) {
/**
@method foo
@description generic
@signature getter
@description this is an accessor
@param bar
@param baz
@return bool
// create an overlay off the jquery object
$('mydiv').geluiOverlay(opts).css(...); // keep on chaining
// get the instance of the overlay back
myOverlay = $('mydiv').data('geluiOverlay');
// or
// get the instance of the overlay bac
myOverlay = $('mydiv').geluiOverlay('instance'); // no chain
@micmath
micmath / codebox-bookmarklet.js
Created January 10, 2011 13:39
drop the selected text into codebox
javascript:var%20d=document,c=d.selection?d.selection.createRange().text:d.getSelection();d.location.href='codebox:add?code='+encodeURIComponent(c)+'&relatedurl='+encodeURIComponent(d.location.href)+'&name='+encodeURIComponent(d.title);
/**
* @name Logging Utility
* @description Adds logging functions to window namespace.
* Adds console logging to browsers that don't have a console (E.G.: IE 6,7 & 8, Safari 2)
* @author Rob Taylor <robert.taylor1@bbc.co.uk>
*/
define('iplayer/utils/logging',
['iplayer/models/cookie'],
function (cookie) {