Skip to content

Instantly share code, notes, and snippets.

View jdsharp's full-sized avatar

Jonathan Sharp jdsharp

  • Northern Wisconsin
View GitHub Profile
// Example of how to cache the result of an external jQuery Template.
// Inspired by this post...
// http://encosia.com/2010/10/05/using-external-templates-with-jquery-templates/
var person = {name: 'Dave'};
var person_tmpl;
$.get('_template.tpl.html', function(template) {
// Use converted string from remote file.
<!DOCTYPE html>
<html>
<head>
<title>jQuery Mockjax Example Query string</title>
<script src="../lib/jquery-1.4.2.js"></script>
<script src="../jquery.mockjax.js"></script>
<script>
$.mockjax({
url: '/rest',
data: { action: "foo" },
@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, ","); });
}
@jdsharp
jdsharp / gist:1005549
Created June 2, 2011 23:13
Apache VHost Mapping
We couldn’t find that file to show.
@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
var ary = 'tlbr'.split(//);
var str = (new Array(5)).join('<span class="flyout__wrapper-{%}"></span>').replace('{%}', function() { return ary.shift(); });
@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

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 / 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'
};