Skip to content

Instantly share code, notes, and snippets.

View bretmorris's full-sized avatar

Bret Morris bretmorris

  • Use All Five
  • Los Angeles, CA
  • X @4bret
View GitHub Profile
@bretmorris
bretmorris / noWidows.js
Last active April 18, 2020 00:10
Very small (and stupid) function for removing widows using a non-breaking-space on a string (client's hate widows)
// NOTE: Can't handle HTML yet
// USE: noWidows('My copy goes here')
// RESULT: My copy goes here
const noWidows = (copy) => copy.replace(/(\s)+(\S*)$/, (match, p1, p2) => ` ${p2}`)

Keybase proof

I hereby claim:

  • I am bretmorris on github.
  • I am bretmorris (https://keybase.io/bretmorris) on keybase.
  • I have a public key ASC5jINfhkU9NDfJ9_oCHBDvM6TiiB5h59qpagMunLxRggo

To claim this, I am signing this object:

var showName = location.pathname.replace('/tagged/', '');
$(document).ready(function() {
//-- Remove 'tagged' from URL
$('#' + showName).show();
});
<script type="text/javascript">
var showName = location.pathname.replace('/tagged/', '');
$(document).ready(function() {
//-- Remove 'tagged' from URL
$('#' + showName).show();
});
</script>
@bretmorris
bretmorris / lightbox.html
Created June 5, 2013 20:46
Lightbox HTML
<div class="overlay">This is the content of the overlay</div>
@bretmorris
bretmorris / lightbox.css
Last active December 18, 2015 03:19
Lightbox CSS
.overlay {
position: absolute;
z-index: 1000; /* Something high */
height: 200px;
width: 200px;
background: white;
top: 50%;
left: 50%;
margin-left: -100px; /* Negative half width */
margin-top: -100px; /* Negative half height */