Skip to content

Instantly share code, notes, and snippets.

View djfarrelly's full-sized avatar
🌞

Dan Farrelly djfarrelly

🌞
View GitHub Profile
@djfarrelly
djfarrelly / placeholder-polyfill.js
Created July 10, 2014 23:08
jQuery placeholder polyfill using Modernizr
;(function($){
function inputFocus(){
var input = $(this);
if (input.val() === input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}
@djfarrelly
djfarrelly / shorten.js
Last active August 29, 2015 14:02
shorten function
// ==================== Existing =========================================
shorten: function(url, callback, reshortenLink) {
// ...
},
// called
Shortener.shorten('site.com/some/url', function(){
// more logic
}, true)
@djfarrelly
djfarrelly / index.js
Created June 9, 2014 17:40
requirebin sketch
var $ = require('jquery');
// I would assume this would work:
var DOMPurify = require('dompurify');
try {
var firstHTML = DOMPurify.sanitize('<p onclick="alert(10);">First worked</p>');
$('body').append( firstHTML );
} catch (err) {
$('body').append( '<p>' + err + '</p>' );