Skip to content

Instantly share code, notes, and snippets.

@donut
donut / Wish List.mkd
Created December 15, 2010 03:55
Things I want but don't need.
  • One thing
@donut
donut / mail() and header().php
Created January 19, 2011 04:57
An introduction to sending emails and redirecting the user with PHP.
<?php
/* Emails in php are typically sent with the `mail()` function.You can see the
* details of that funciton here:
* http://php.net/manual/en/function.mail.php
* Then, to redirect the user you can use the `header()` function. You can
* learn more about that function here:
* http://us2.php.net/manual/en/function.header.php Here's a
* very simple solution. I'll assume you've already populated the variables I
* use.
*/
/* Copyright (c) 2009 Mustafa OZCAN (http://www.mustafaozcan.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
* Version: 1.0.2
* Requires: jquery.1.3+
*/
jQuery.fn.fixedtableheader = function (options) {
var settings = jQuery.extend({
headerrowsize: 1,
highlightrow: false,
@donut
donut / espresso-html_comment_freak.php
Created July 27, 2011 23:31
Espresso 2.0a4 PHP+HTML comment freakout
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]--><?php echo "magic!" ?>

Steps for reproducing issues with project-wide find:

  1. Open a project (or drag a folder onto Espresso)
  2. Do a project-wide find for something.
  3. Switch to a different application in whatever way you please.
  4. Switch back to Espresso

Result:

The search results go away and if a result was selected before switching to a different application, that result will not show up in subsequent searches. Re-opening the folder/project allows any affected files to appear in search results again.

@donut
donut / getBGImgURLsFromCSSs.js
Created October 17, 2011 21:08
Builds a list of images found in the linked style sheets
/* Builds a list of images found in the linked style sheets
*
* Adapted from stackoverflow.com/questions/2430503/list-of-all-background-images-in-dom/2453880#2453880
*
* This method has the advantage of finding URLs for background images that no
* element in the DOM uses yet.
*
* @return {array}
* List of unique image URLs as specified in the style sheets.
------------------------------------------------------------------------- */
@donut
donut / donutCarousel.js
Created October 21, 2011 05:15
Basic jQuery carousel plugin
/** A carousel plugin
@author Donovan Mueller (zotobi@gmail.com)
@url https://gist.github.com/1303150
------------------------------------------------------------------------ */
;(function donutCarouselPlugin($){
var $methods = {}
, $settings = { frameSelector: '.slides'
, listSelector: 'ul'
// Assumed to be a child of `frameSelctor`.
// The list of slides will be built from the direct
@donut
donut / is_touch_based.js
Created October 24, 2011 21:53
UA sniffing for touch-based browsers.
// Is this a touch-based device?
window.navigator.isTouchDevice =
( window.navigator.userAgent &&
window.navigator.userAgent.search(
/iPod|iPad|iPhone|IEMobile|BlackBerry|webOS|Android|Fennec/i
) !== -1 );
@donut
donut / is_popup_window.js
Created October 24, 2011 21:54
Is popup window
// Try to guess if the current window is a "popup"
window.isPopup =
window.isPopup || window.opener ||
(window.locationbar && window.locationbar.visible === false) ||
false;
@donut
donut / DD_belatedPNG.js
Created October 26, 2011 23:38
Fix PNGs in IE < 9 jQuery plugin
/* The code below should be included in a separate file using IE conditional comments
as it causes errors in IE8(+?) */
/**
* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
* Version: 0.0.8a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license