Skip to content

Instantly share code, notes, and snippets.

View jessebeach's full-sized avatar
🦆
mostly there

J. Renée Beach jessebeach

🦆
mostly there
  • Facebook / Meta
  • Redwood City, CA
  • 20:47 (UTC -07:00)
  • X @jessebeach
View GitHub Profile
@jessebeach
jessebeach / gist:3007875
Created June 28, 2012 00:33
A fake proxy because jQuery 1.4.4 can't handle an overloaded proxy function.
function fakeProxy(fn, context) {
var args = Array.prototype.slice.call(arguments, 2);
return function () {
fn.apply(context, args);
}
}
@jessebeach
jessebeach / gist:3018853
Created June 29, 2012 16:07
Bare-bones Callbacks implementation for jQuery 1.2.6
var Callbacks = function () {
// An array of functions.
var callbacks = [];
/**
* Pushes a supplied function into the list of functions.
*/
function addCallback(callback) {
callbacks.push(callback);
}
/**
@jessebeach
jessebeach / gist:3039791
Created July 3, 2012 13:50
underscore.js#debounce()
// @see http://underscorejs.org/underscore.js
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
_.debounce = function(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
@jessebeach
jessebeach / gist:3072656
Created July 8, 2012 20:19
Building objects the IIFE way
var Speaker = (function () {
function Hello() {
}
Hello.prototype.repeatAfterMe = function (message) {
return message || 'fine, be that way';
};
return Hello;
}());
@jessebeach
jessebeach / gist:3133780
Created July 18, 2012 02:46
Responsivizer CSS
/* @group Responsive */
/* @group Modern browsers */
@media screen {
#navigation .content > .menu > li > a {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@jessebeach
jessebeach / gist:3146242
Created July 19, 2012 19:34
Acquia Responsivizer plugin
(function ($) {
var plugin = 'responsiviser';
// Local copy of jQuery.
var Drupal = window.Drupal;
Drupal.behaviors[plugin] = {
attach: function (context, settings) {
$('body').once(plugin, function (index) {
var $pageWidth = $('.page-width');
var $stackWidth = $('.stack-width');
From aca29b9e2f0a7df396837cb3bf6d6fda1edec28d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"J.=20Ren=C3=A9e=20Beach"?= <jesse.beach@acquia.com>
Date: Thu, 26 Jul 2012 13:35:50 -0400
Subject: [PATCH 1/4] DG-4778 / DG-4776 - changed the registration of an
iframe resizing callback from the jQuery UI 'show'
event to the 'load' event so that the calculation of
the height of iframe content happens after the jQuery
UI tabs are loaded and painted.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
@jessebeach
jessebeach / jquery.supplantclass.js
Created July 27, 2012 22:13
supplantClass jQuery plugin
/**
* supplantClass() jQuery plugin
*
* Adds the replacement class string to each element.
*
* If a class or classes contain the needle, they are removed from the element.
*/
(function ($) {
// Add the plugin as a property of the jQuery fn object.
$.fn['supplantClass'] = function (needle, replacement) {
@jessebeach
jessebeach / gist:3238296
Created August 2, 2012 16:13
Media module: Overriding styles. This will not be contributed back, but will live as a patch forever.
diff --git a/css/media.css b/css/media.css
index 68cfc6273971faafa5209b8fb392da4b867ed43d..2084b79a4388b2636e7817479d0d19b5147f78b6 100644
--- a/css/media.css
+++ b/css/media.css
@@ -247,14 +247,8 @@ div#media-browser .throbber {
background: #FFF;
}
-#media-browser-tabset .media-browser-tab {
- border: 1px solid #aaa;
@jessebeach
jessebeach / gist:3239414
Created August 2, 2012 18:26
Media module: replacing 'show' with 'load'
diff --git a/includes/media.browser.inc b/includes/media.browser.inc
index ae1c826..8c0d010 100644
--- a/includes/media.browser.inc
+++ b/includes/media.browser.inc
@@ -69,17 +69,26 @@ function media_browser($selected = NULL) {
//Add any JS settings
$browser_settings[$key] = isset($plugin['#settings']) ? $plugin['#settings'] : array();
- // If this is a "ajax" style tab, add the href, otherwise an id.
- $href = isset($plugin['#callback']) ? $plugin['#callback'] : "#media-tab-$key";