Skip to content

Instantly share code, notes, and snippets.

@mklickman
mklickman / viewport-width.js
Last active December 11, 2015 15:38
Add this to either the head of your document, or load as an external script, and it will add a small widget to the top left corner of your browser window showing the current width of the viewport. Make sure you load jQuery first.
$(document).ready(function() {
var $counter = $('<p class="viewport-width-counter" />');
$('html').append($counter);
if ($('p.viewport-width-counter').length) {
$counter.css({
'position': 'fixed',
'top': 0,
@mklickman
mklickman / test.html
Created March 25, 2012 01:15
HTML5 video that doesn't work in Firefox
<video controls>
<source src="http://www.mundihomes.com/inc/vid/morganville_exterior.theora.ogv" type="video/ogg" codecs="theora, vorbis">
</video>
@mklickman
mklickman / _form.html.erb
Created February 10, 2012 17:01
Basic Rails Contact Form and Mailer
<%= form_for(@contact) do |f| %>
<% if @contact.errors.any? %>
<div id="error_explanation">
<h3><%= pluralize(@contact.errors.count, "error") %> prohibited this contact from being saved:</h2>
<ul>
<% @contact.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>