Skip to content

Instantly share code, notes, and snippets.

View ericclemmons's full-sized avatar
🏠
Working from home

Eric Clemmons ericclemmons

🏠
Working from home
View GitHub Profile
@ericclemmons
ericclemmons / My_Db_Table.php
Created June 15, 2009 20:35
Add "findBy" magic method to Zend_Db_Table objects
<?php
/**
* My_Db_Table
*
* Adds "findBy" magic method to Zend_Db_Table objects
*
* @author Eric Clemmons
**/
@ericclemmons
ericclemmons / svndiff
Created August 12, 2009 16:29
Run "svndiff" and view the results in FileMerge (OS X)
#!/usr/bin/python
from sys import argv
from os import execlp
import re
left = "";
right = "";
@ericclemmons
ericclemmons / Error.js
Created September 8, 2009 20:27
demo.ui.Error.js
// Register this class autoloading
dojo.provide('demo.ui.Error');
// Include dependencies
dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
// Create class declaration extending templating system
dojo.declare('demo.ui.Error', [dijit._Widget, dijit._Templated], {
@ericclemmons
ericclemmons / demo.ui.Error.css
Created September 8, 2009 20:31
demo.ui.Error.css
.demoUiError {
font-size: 0.9em;
position: relative;
margin: 10px 10px 15px 10px;
width: 293px;
color: white;
font-family: "Helvetica Neue", Helvetica,Arial,sans-sarif;
}
@ericclemmons
ericclemmons / Error.html
Created September 8, 2009 20:31
demo.ui.Error.html
<div class="demoUiError"
dojoAttachEvent="onmouseover:_hoverOver,onmouseout:_hoverOut,onclick:close">
<p>
${message}
</p>
<div class="footer"></div>
</div>
@ericclemmons
ericclemmons / example.demo.ui.Error.html
Created September 9, 2009 05:19
Example of demo.ui.Error
<!-- Dojo Config -->
<script type="text/javascript">
// Since we're using CDN resources, we have to define any local
// module paths first
var djConfig = {
// parseOnLoad: true, // Look for dojo events/hooks
// isDebug: true, // Enable debugging
baseUrl: "/static/js/", // Base path for all modules
modulePaths: {
demo: "demo" // Path to "demo" namespace
@ericclemmons
ericclemmons / endless-scroll.fmylife.jquery.js
Created September 10, 2009 20:59
Run this script on FMyLife.com for endless scroll
(function($) {
$.extend($.expr[':'],{
inView: function(a) {
var st = (document.documentElement.scrollTop || document.body.scrollTop),
ot = $(a).offset().top,
wh = (window.innerHeight && window.innerHeight < $(window).height()) ? window.innerHeight : $(window).height();
return ot > st && ($(a).height() + ot) < (st + wh);
}
});
/*
Script: DOM.js
Class: DOM
Allows for the building of a DOM node-tree via an array. You can
assign any attribute, events, styles, and even content with this class.
Author:
Eric Clemmons
@ericclemmons
ericclemmons / TastePreferences.Netflix.jquery.js
Created January 17, 2010 01:48
Replace "Need some examples?" with actual examples
/*
Author: Eric Clemmons
Library: jQuery 1.3.2
When visiting "http://www.netflix.com/TastePreferences?lnkctr=wnph_sc_tst", I found myself
Clicking each "Click for example" link to better select my preference.
So, this script simply replaces that link with the first THREE suggested movie images.
Just Copy-Paste into Firebug & Run!
*/
@ericclemmons
ericclemmons / SortSelect.jquery.js
Created February 15, 2010 21:56
Sort a SELECT box's OPTIONs alphabetically
var SortSelect = function(select) {
var options = jQuery.makeArray(select.find('option'));
var sorted = options.sort(function(a, b) {
return (jQuery(a).text() > jQuery(b).text()) ? 1 : -1;
});
select.append(jQuery(sorted))
.attr('selectedIndex', 0);
};