Skip to content

Instantly share code, notes, and snippets.

@lindsayevans
lindsayevans / css-compression-optimiser.html
Created December 21, 2010 23:40
Optimise CSS rules for HTTP compression
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS Compression Optimiser</title>
<style type="text/css">
.col {
float: left;
<!DOCTYPE html>
<html lang="en">
<body>
<nav role="navigation" id="primary">abc</nav>
<nav role="navigation" id="secondary">def</nav>
<nav role="navigation" id="page">ghi</nav>
<nav role="navigation" id="footer">jkl</nav>
</body>
@lindsayevans
lindsayevans / gist:704625
Created November 18, 2010 04:25
HTML5 <video> bug in FF3.6
Tested in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729)
The following HTML:
<video controls>
<source src="foo.ogv" type='video/ogg; codecs="theora, vorbis"'>
</video>
Will cause Firefox to make an extra HTTP request for the URL '/' (verified in Firebug's Net panel & Live HTTP Headers extension)
Adding a 'poster' attribute to the video element will fix this, but is sometimes not desirable/possible.
- An empty poster attribute (poster="") will not work
jQuery.fn.hammerTime = function(){return this;};
Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.36 Safari/534.3
Timing 100000 iterations of dollar_data, el_data...
el_data: 4.104s @ 24808/s (n=101813, x=1921, b=0.037ms, w=0.073ms, a=0.040ms)
dollar_data: 1.375s @ 77825/s (n=107010, x=10701, b=0.009ms, w=0.025ms, a=0.013ms)
Rate el_data dollar_data
el_data 24808/s -- -68%
dollar_data 77825/s 214% --
Tests duration: 5.479 seconds.
Total duration: 6.095 seconds.
var PekingDuck = (function(_this){
// How many people this duck will feed
_this.feeds = 5;
_this.after_sydjs = false;
// Returns the number of ducks needed to feed the supplied number of people
_this.for = function(people){
if(isNaN(people)) return 'BBQ pork';
var f = people / _this.feeds, i = Math.floor(f), d = f - i > 0 ? i + ((f - i > 0.5) ? 1 : 0.5) : i;
#lazyweb is there a haml option to not stick elements on a new line if they're the only child? e.g.
(using haml -f html5 -q infile.haml > outfile.html)
make:
%ul
%li
%a{:href => "#"} Commercial
%li
%a{:href => "#"} Residential
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hAiku</title>
<style>
[itemprop=hAiku] { font-size: 3em; margin: 1em 0; }
[itemprop=hAiku] [itemprop=kireji], [itemprop=hAiku] [itemprop=cutting] { font-weight: bold; color: #500; }
[itemprop=hAiku] [itemprop=kigo], [itemprop=hAiku] [itemprop=season] { font-style: italic; color: #500; }
if(typeof console === 'undefined'){
var console = {
log: function(s){
var $d = $('#debug-panel');
if(!$d[0]){
$d = $('<div id="debug-panel" style="height:300px;overflow: auto;border: 1px solid #000;padding:10px;font-family:monospace;"></div>').appendTo('body');
}
$d.html($d.html() + '<br/>' + s);
}
var PROJECT_NAME = (function($){
// Self
var _this = {};
// Puublic methods
_this.init_body = function(){
$('body').addClass('js-enabled');
};