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 / 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 / GetMessages.php
Created March 15, 2010 20:54
Zend Framework FlashMessenger Helper
<?php
/**
* GetMessages
*
* @author Eric Clemmons (eric@smarterspam.com)
* @category Zend
* @package Zend_View
* @subpackage Helper
*
@ericclemmons
ericclemmons / update-datetime.sql
Created April 8, 2010 18:25
Update a table's responses' datetimes so that all records have occurred recently
-- @last = the very last response
SELECT @last:=UNIX_TIMESTAMP(response_date) FROM responses GROUP BY response_date DESC LIMIT 1;
-- @diff = how much time has passed since the last response
SELECT @diff:=(UNIX_TIMESTAMP() - @last);
-- Add the date difference to all responses to chronologically bring them up to date
UPDATE responses SET response_date=FROM_UNIXTIME(UNIX_TIMESTAMP(response_date) + @diff);
@ericclemmons
ericclemmons / zend_wtform.php
Created May 17, 2010 21:37
This is how easy Zend_Form->persistDate() is
public function persistData($namespace = 'My_Super_Awesome_Form')
{
if (null === $this->_session) {
$this->_session = new Zend_Session_Namespace($namespace);
}
if ($this->_session->values) {
$this->populate($this->_session->values);
}
@ericclemmons
ericclemmons / My_Log_Writer_Backlog.php
Created July 7, 2010 20:29
Have Zend_Log_Writer_Mail send you entire error backlog
<?php
class Forms_Log_Writer_Backlog extends \Zend_Log_Writer_Mail
{
/**
* Array of all events sent to writer, unfiltered.
*
* @var array
*/