Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- According to Heather Champ, former community manager at flickr,
you should not allow search engines to index your "Contact Us"
var li=document.getElementById('timeline').querySelectorAll('li.status');for(var i in li){try{var c=li[i].querySelectorAll('.entry-content')[0];if (/tw[i\!\|]fficiency/i.test(c.innerHTML)) li[i].parentNode.removeChild(li[i]);}catch(e){}}
<?php
$crop = '';
if ($image_width / $image_height > $width / $height) {
$crop .= ' -resize "x'.$height.'"';
$resized_w = ($height / $image_height) * $image_width;
$crop .= ' -crop "'.$width.'x'.$height.'+'.round(($resized_w - $width) / 2).'+0" +repage';
} else {
$crop .= ' -resize "' . $width . 'x"';
$resized_h = ($width / $image_width) * $image_height;
$crop .= ' -crop "'.$width.'x'.$height.'+0+'.round(($resized_h - $height) / 2).'" +repage';
String.prototype.toInt = function(){
var neg = /^-/.test( this );
return ( neg ? -1 : +1 ) * ( parseInt( this.replace(/[\W]+/g, '') ) || 0 );
};
<?php
$files = array();
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file[0] !== '.') {
// This is the conclusion to my tests of determining the best way to cache images.
// I used apache access logs to determine when an image was actually requested from the web server.
// The following code, although not that elegant, works fine in IE6, IE7, IE8, FF3, Safari, Chrome, Opera
var _cacheImages = [];
function cacheImages(images){
(function(window, document, undefined){
// !incomplete
var comments = [];
function hideComments(content){
var c = -1;
var options = {
width: 425, // player width (integer or string)
height: 356, // player height (integer or string)
swfobject: window.swfobject, // swfobject object
playlist: {}, // playlist object (object literal)
showPlaylist: 1, // show playlist on plugin init (boolean)
showTime: 1, // show current time and duration in toolbar (boolean)
showTitleOverlay: 1, // show video title overlay text (boolean)
videoThumbs: 0, // show videos as thumbnails in the playlist area (boolean) (experimental)
randomStart: 0, // show random video on plugin init (boolean)
var events = {
onReady: function(){}, // after player has been constructed and first video has been cued
onVideoPlay: function(){}, // when video starts to play
onVideoPaused: function(){}, // when video has paused
onBuffer: function(){}, // when video starts to buffer
onError: function(errorMsg){} , // when there was an error loading a video
onBeforePlaylistLoaded: function(){}, // before the playlist has started loading (ajax event)
onAfterPlaylistLoaded: function(){}, // after the playlist has finished loading (ajax event) (will execute on error)
onVideoLoad: function(videoID){}, // when a video is loaded into the player, regardless if successful or not
onVideoCue: function(videoID){}, // after a video has been cued
// In the quest to find a good jQuery plugin design pattern,
// I have collated some of the techniques I have used in the past in this file.
(function($, window, document, undefined){
$.fn.myplugin = function(method){
var pluginName = 'myplugin', args = arguments, val = undefined;
this.each(function(){