Easter eggs jQuery plugin
I decided that a project I was working in needed more monsters so I created a quick jQuery plugin to add them, have fun.
//Change image
//<div data-swapcss-value='url("imageurl.png")'>
//Full options
//<div data-swapcss-property='background-color' data-swapcss-value='red' data-swapcss-count="3">
var swapCssConfig = {}
var swapCssConfig.currentCount = 0;
(function ($) {
$.fn.swapCSS = function (options) {
var settings = jQuery.extend({
clickCount: 6,
property: 'background-image'
}, options);
var currentElement = this;
currentElement.click(function () {
warningClickCount++;
if (swapCssConfig.currentCount > (settings.clickCount - 1)) {
currentElement.css(settings.property, settings.value);
currentElement.unbind('click');
}
});
};
$(document).ready(function () {
$('[data-swapcss-value]').each(function (index) {
var item = $(this);
var options = { value: item.attr('data-swapcss-value') };
if (item.attr('data-swapcss-count') !== undefined)
options.clickCount = item.attr('data-swapcss-count');
if (item.attr('data-swapcss-property') !== undefined)
options.property = item.attr('data-swapcss-property');
item.swapCSS(options);
});
});
})(jQuery);
The perils of message placement
Today I entered a contest to win a windows phone I filled in the form and clicked send the form cleared and nothing happerned, or so I thought.

I scrolled down a little and there was a success message, It goes to show if you place a ajax message in the wrong place it can lead to confusion. If the message was above the submit button it would of been fine.

Shrinking Twitter Bootstrap
I really like the Twitter bootstrap but there is one small problem the css file has a bunch of styles that I never used and is slowing down the page load.
Luckly the the people at twitter use less so its pretty easy to customise the css to only include what you want.
For my new iPad Kids game site I wanted to use the reset and the layout and nothing else. To do this:
- Download the source from github.
- Open
lib/bootstrap.less - Comment out the stuff you don’t want (see below)
- Then Compress (I use less.app because I am lazy but the command line app works too).
Reset and Layout Only
// CSS Reset
@import "reset.less";
// Core variables and mixins
@import "variables.less"; // Modify this for custom colors, font-sizes, etc
@import "mixins.less";
// Grid system and page structure
@import "scaffolding.less";
// Styled patterns and elements
//@import "type.less";
//@import "forms.less";
//@import "tables.less";
//@import "patterns.less";
My Typography Cheat Sheet
I know very little about web design and typography in fact most it is from one presentation, so here is my typography cheat sheet.
My Typography Cheat Sheet
- Line height of 1.3-2.0 ems
- Column width: 2 alphabets
- Body text: 16px
- 2-3 typefaces, maximum
- Sans-serif (ex. Helvetica) for titles
- Serif (ex. Georgia) for body text
Some Links
It good when other people get bugs through to production too.