Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Murtaugh murtaugh

View GitHub Profile
@murtaugh
murtaugh / sarcastic.html
Created Dec 23, 2011
The Sarcastic Font Treatment (inspired by the Sarcastic Font project: http://glennmcanally.com/sarcastic/)
View sarcastic.html
<style>
em.sarcastic {
display: inline-block;
font-style: normal;
-webkit-transform: rotate(-15deg) skew(0, 15deg);
-moz-transform: rotate(-15deg) skew(0, 15deg);
@murtaugh
murtaugh / 1. single-line.html
Last active Nov 26, 2020
Blockquote patterns for ALA
View 1. single-line.html
<figure class="quote">
<blockquote>It is the unofficial force—the Baker Street irregulars.</blockquote>
</figure>
@murtaugh
murtaugh / cursor-reset.css
Last active Feb 17, 2020
CSS Cursor Reset
View cursor-reset.css
html,
body {
cursor: default;
}
code {
cursor: text;
}
/*
View Regexes
Email regex: (supports pluses and dots in username)
/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/
URL regex: (validates both with and without http://)
/^((http|https):\/\/)?(www[.])?([a-zA-Z0-9]|-)+([.][a-zA-Z0-9(-|\/|=|?)?]+)+$/
@murtaugh
murtaugh / autogrow.js
Last active Dec 19, 2015 — forked from jlong/jquery.autogrow.js
I un-plugin-ified this for my own purposes.
View autogrow.js
(function($){
$(document).ready(function (){
$('textarea[data-autoresize]').on('input propertychange', function() {
autoResize($(this));
});
@murtaugh
murtaugh / In-Page Nav Functions.js
Last active Dec 20, 2015
In-page nav, with smooth scrolling, update on scroll, and proper location.hash updating
View In-Page Nav Functions.js
$(document).ready(function() {
$("#in-page-nav-1 a").click(function(e){
e.preventDefault();
var dest = 0;
if ($(this.hash).offset().top > $(document).height()-$(window).height()){
View code-sample-with-caption.html
<figure class="code">
<pre><code class=“language-markup”>&lt;meta charset="utf-8"/></code></pre>
<figcaption>A UTF-8 encoding declaration should appear at the beginning of every &lt;head&gt; element.</figcaption>
</figure>
View columns.css
.columns {
display: block;
list-style-type: none;
margin-bottom: 24px;
-moz-column-count: 2;
-moz-column-gap: 24px;
-webkit-column-count: 2;
-webkit-column-gap: 24px;
column-count: 2;
column-gap: 24px;
@murtaugh
murtaugh / placeholder-polyfill.js
Created Sep 20, 2013
In my experience, `placeholder` polyfills try way too hard, and the results are mixed. Here's mine.
View placeholder-polyfill.js
if (!Modernizr.input.placeholder) {
$('*[placeholder]').each(function() {
placeholder = $(this).attr('placeholder');
$(this).attr('value', placeholder).addClass('fakePlaceholder');
});
@murtaugh
murtaugh / auto-footnote.js
Last active Sep 19, 2017
Sniff out superscripts that should be footnote links
View auto-footnote.js
$('sup[data-footnote]').each(function(index) {
noteCount = $(this).html();
$(this).html('<a id="ref' + noteCount + '" href="#note' + noteCount + '">' + noteCount + '</a>');
$('#footnotes li').eq(noteCount - 1).attr('id', 'note' + noteCount).prepend('<a href="#ref' + noteCount + '">' + noteCount + '.</a> ');
});
You can’t perform that action at this time.