Skip to content

Instantly share code, notes, and snippets.

View jdsharp's full-sized avatar

Jonathan Sharp jdsharp

  • Northern Wisconsin
View GitHub Profile
@jdsharp
jdsharp / sample.js
Created November 11, 2016 16:17
React Unmanaged DOM Node Wrapping
const UnmanagedDOMContainer = React.createClass({
getDefaultProps() {
return {
nodes : null
};
},
componentWillReceiveProps(newProps) {
if ( !this.props.nodes && newProps.nodes ) {
this.appendNodes(newProps.nodes);
@jdsharp
jdsharp / lazy-load-hooks.js
Created April 21, 2015 19:58
Hooks for lazy loading images
window.isCloseToViewport = function(node, howClose) {
if ( !node ) {
return false;
}
var factor = howClose;
if ( !factor ) {
factor = 1;
}
var doc = node && node.ownerDocument && node.ownerDocument.documentElement;
@jdsharp
jdsharp / animation-events.js
Created April 15, 2015 18:01
Animation and Transition Events
// Inspiration via: http://davidwalsh.name/css-animation-callback
var addAnimationEndEvent = function(el, fn) {
var t;
var animations = {
'animation' : 'animationend',
'OAnimation' : 'oAnimationEnd',
'MozAnimation' : 'animationend',
'WebkitAnimation' : 'webkitAnimationEnd'
};

Keybase proof

I hereby claim:

  • I am jdsharp on github.
  • I am jdsharp (https://keybase.io/jdsharp) on keybase.
  • I have a public key whose fingerprint is BC29 08A4 73CD BEA1 A37C 272B EA63 3C4C 7EBA C98E

To claim this, I am signing this object:

@jdsharp
jdsharp / gist:b1de07592aef3515221c
Last active August 29, 2015 14:06
My linux server build
OS: Debian 7
Case
http://www.newegg.com/Product/Product.aspx?Item=N82E16811352027
550W Power Supply
http://www.newegg.com/Product/Product.aspx?Item=N82E16817371016
SATA Card
http://www.newegg.com/Product/Product.aspx?Item=N82E16816124062
var ary = 'tlbr'.split(//);
var str = (new Array(5)).join('<span class="flyout__wrapper-{%}"></span>').replace('{%}', function() { return ary.shift(); });
@jdsharp
jdsharp / gist:1622308
Created January 16, 2012 18:51
E-mail response
I'm terribly sorry to hear of the loss, that sounds like a nightmare. I personally haven't heard anything
back from the adjuster, but also wasn't aware that I was to be in contact with one. I'm guessing though,
this is a case of mistaken identity. I receive a number of e-mail's intended for Mr. Sharp who unfortunately
is an individual who has become confused regarding his e-mail address. The e-mail that he's been providing
to those intending to contact him for the past 18 months is in fact my e-mail which I've had since 2003
when gmail was not yet released to the broad public.
If you do in-fact determine Mr. Sharp's correct e-mail, please kindly reply with it as I'll be more than
willing to forward messages to him when appropriate. (I often receive e-mails for Best Buy software
subscriptions, Apple iTunes purchases and even photos from individuals that I am certain were NOT intended
@jdsharp
jdsharp / gist:1005549
Created June 2, 2011 23:13
Apache VHost Mapping
We couldn’t find that file to show.
@jdsharp
jdsharp / DirtyCommas.js
Created March 3, 2011 04:17
Quick and dirty code to insert commas after every 3 digits (also handles decimals correctly)
// via @DmitryBaranovsk
function dirtyCommas(num) {
return String(num).replace(/^\d+(?=\.|$)/, function (int) { return int.replace(/(?=(?:\d{3})+$)(?!^)/g, ","); });
}