Skip to content

Instantly share code, notes, and snippets.

View murtaugh's full-sized avatar
👋

Tim Murtaugh murtaugh

👋
View GitHub Profile
@murtaugh
murtaugh / sarcastic.html
Created December 23, 2011 20:24
The Sarcastic Font Treatment (inspired by the Sarcastic Font project: http://glennmcanally.com/sarcastic/)
<style>
em.sarcastic {
display: inline-block;
font-style: normal;
-webkit-transform: rotate(-15deg) skew(0, 15deg);
-moz-transform: rotate(-15deg) skew(0, 15deg);
Headers as columns:
<table>
<tr>
<th scope="col">User costs</th>
<th scope="col">Business costs</th>
</tr>
<tr>
<td>What about your product might the user ignore if a form is onerous?</td>
<td>Where will you keep all of this stuff?</td>
</tr>
@murtaugh
murtaugh / Regexes
Last active December 16, 2015 07:19
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 / SVG-thumbnail-redirect
Created December 17, 2015 04:01
ExpressionEngine: use htaccess to redirect requests for SVG thumbnails
RewriteRule /assets_content/(.*)/_thumbs/(.*)\.svg$ /assets_content/$1/$2.svg [NC,L]
@murtaugh
murtaugh / autogrow.js
Last active December 19, 2015 07:59 — forked from jlong/jquery.autogrow.js
I un-plugin-ified this for my own purposes.
(function($){
$(document).ready(function (){
$('textarea[data-autoresize]').on('input propertychange', function() {
autoResize($(this));
});
@murtaugh
murtaugh / In-Page Nav Functions.js
Last active December 20, 2015 04:39
In-page nav, with smooth scrolling, update on scroll, and proper location.hash updating
$(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()){
@murtaugh
murtaugh / columns.css
Created September 16, 2013 19:48
CSS Columns
.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 September 20, 2013 15:21
In my experience, `placeholder` polyfills try way too hard, and the results are mixed. Here's mine.
if (!Modernizr.input.placeholder) {
$('*[placeholder]').each(function() {
placeholder = $(this).attr('placeholder');
$(this).attr('value', placeholder).addClass('fakePlaceholder');
});
<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>
@murtaugh
murtaugh / hide-genius-annotations.css
Last active March 29, 2016 16:49
Attempts to hide Genius annotations
// hides the yellow indication of an annotation
genius-referent {
background: transparent !important;
cursor: text !important;
}
// hides the "Annotate" popup that appears when you select text
genius-pre-annotation-prompt {
display: none !important;
}