Gas Mask is a simple hosts file manager for Mac OS X Snow Leopard & Lion. It allows to edit hosts files and switch between them.
Web Design Page 2 of 7
Topics:
11px Verdana on Retina Displays
Do you remember the days of 11px Verdana used almost universally across the web? This how it looks relative to the new high resolution devices with Retina displays.
Here is a sample page with some text set in 11px Verdana. It would be great if you could snap a photo of this page being rendered on one of the high resolution screens. Use the hashtag #11pxverdana.
3D DOM Element Inspector in Firefox
The new 3D DOM inspector in Firefox is simply amazing. Just look at those skyscrapers of the social share buttons — Twitter and StumbleUpon seem to be the thinest.
Page Stacks in UI
The concept of page stacks is something brilliant for building leveled navigation and giving users immediate glimpse of the big picture.
(via onkulis.com)
How to Remove All Line Breaks from Text Using Regex
If you are generating <meta> description tags automatically (e.g. by including all headings of the document), chances are that you’re extracting it from various sources of content that contain different HTML elements and line breaks in them. Here is a simple regular expression to remove all line breaks, carriage returns and tabs, and replace them with an empty space.
$text = preg_replace("/\r\n+|\r+|\n+|\t+/i", " ", $text);
How to Extract Heading Content (H1, H2, etc.) from an HTML String Using Regex
Headlines and headings are usually very relevant and descriptive pieces of information for any HTML page. You might want to include them into the description <meta> tag on that page. Here is a simple regular expression to extract all those headings:
preg_match_all('|<h[^>]+>(.*)</h[^>]+>|iU', $html, $headings);
HTML5 Notepad App Update
I have released an updated version of my HTML5 Notepad app which features a new user interface, adds support for Markdown syntax (along with a simple editor and preview) and fixes a synchronization bug which in some cases converted line breaks into text.
Please note that there could still be some bugs and the code hasn’t been polished for a production use, but it serves as a very useful example of some of the most interesting HTML5 features such as localStorage and offline cache.
You can fork it on GitHub or download from the project page.
How to Embed Your YouTube Channel as a Playlist
Update: There is an undocumented ID of your channel playlist which is available in the current beta version of YouTube UI as described by Federico in the comments.
For some reason YouTube doesn’t offer a simple way to embed your YouTube channel. The only official method is to manually create a playlist with all your videos and embed that. However, it requires additional work after every upload which is not cool, especially if you’re on a mobile. Here is a simple script that creates an HTML5 (iframe) player using the YouTube API:
(function() {
function createPlayer(jqe, video, options) {
var ifr = $('iframe', jqe);
if (ifr.length === 0) {
ifr = $('<iframe scrolling="no" frameborder="no">');
ifr.addClass('player');
if (options.playeropts)
ifr.attr(options.playeropts);
}
var src = 'http://www.youtube.com/embed/' + video;
if (options.playopts) {
src += '?';
for (var k in options.playopts) {
src+= k + '=' + options.playopts[k] + '&';
}
}
ifr.attr('src', src);
jqe.append(ifr);
}
var defoptions = {
autoplay: false,
user: null,
player: createPlayer,
playeropts: {},
loaded: function() {},
playopts: {
fs: 1,
showinfo: 1,
modestbranding: 1
}
};
$.fn.extend({
youTubeChannel: function(options) {
var md = $(this);
var allopts = $.extend(true, {}, defoptions, options);
$.getJSON('http://gdata.youtube.com/feeds/api/users/' + allopts.user + '/uploads?alt=jsonc&v=2', null, function(data) {
var videos = [];
var playlist = '';
$.each(data.data.items, function(i, item) {
videos.push(item.id);
if (i > 0)
playlist += item.id + ',';
});
allopts.playopts.playlist = playlist;
allopts.player(md, videos[0], allopts);
});
}
});
})();
$(function() {
$('#player').youTubeChannel({user:'kasparsdambis', playeropts: { width: 400, height: 280 }});
});
WebKit Bug: Anti-aliasing for @font-face fonts
This is a known Webkit bug — any text with @font-face applied will be rendered without anti-aliasing if there is a text element without anti-aliasing applied preceding it. Usually those are fonts smaller than 5px or monospaced fonts at small sizes which are rendered without anti-aliasing.
I noticed this bug on this page — the heading “Kāzu ABC” was rendered aliased despite having the main menu in between that heading and the logo which had font-size:1px; applied. The only way to fix this is by avoiding aliased text directly before elements that use @font-face.
Here is a live demo of the bug.
Akismet, Akismet, Akismet
Akismet is a fantastic service that does only one thing and does it very well — it fights comment spam. Their homepage, however, is full of various keywords that dilute that simple message:
Here are a few things that are wrong with this design: dictionary definition cliche; why is the spam count so prominent and has two versions — I bet that most people can’t even pronounce that number; too many words to explain a simple idea.
Here is a suggested re-align:
Page 2 of 7






