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 / 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 */
@bretmorris
bretmorris / lightbox.html
Created June 5, 2013 20:46
Lightbox HTML
<div class="overlay">This is the content of the overlay</div>
<script type="text/javascript">
var showName = location.pathname.replace('/tagged/', '');
$(document).ready(function() {
//-- Remove 'tagged' from URL
$('#' + showName).show();
});
</script>
var showName = location.pathname.replace('/tagged/', '');
$(document).ready(function() {
//-- Remove 'tagged' from URL
$('#' + showName).show();
});

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:

@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&nbsp;here
const noWidows = (copy) => copy.replace(/(\s)+(\S*)$/, (match, p1, p2) => `&nbsp;${p2}`)
<a-sphere
radius="0.0365"
color="white"
position="0 2.34 -18.4404">
</a-sphere>
<a-entity
id="secondaryHand"
oculus-touch-controls="hand: left">
</a-entity>
<a-entity
id="primaryHand"
oculus-touch-controls="hand: right">
</a-entity>
<a-sphere
animation="property: position; to: 0 0.9144 0; dur: 375;"
id="ball"
radius="0.0365"
color="white"
position="0 2.34 -18.4404">
</a-sphere>
<script>
AFRAME.registerComponent("trigger-listener", {
init: function () {
var el = this.el;
el.addEventListener("triggerdown", function (evt) {
document.getElementById("ball").emit("throw");
});
},
});
</script>