Skip to content

Instantly share code, notes, and snippets.

View hkfoster's full-sized avatar

H. Kyle Foster hkfoster

  • Richmond, Virginia
View GitHub Profile
@hkfoster
hkfoster / nodemaker.js
Last active August 29, 2015 14:02
Native JS Node Maker Function
/**
* Node Maker Function
* @author Kyle Foster
*/
var makeNode = function( parent, content ) {
var node = document.createElement( parent );
if ( content ) node.innerHTML = content;
return node;
};
{
"bold_folder_labels": true,
"color_scheme": "Packages/Theme - Flatland/Flatland Monokai.tmTheme",
"flatland_sidebar_tree_large": true,
"flatland_square_tabs": true,
"font_size": 15,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
@hkfoster
hkfoster / smarten.js
Created January 11, 2014 16:41
Replace dumb quotes with smart quotes, double dashes with an em dash, and three dots with an ellipsis.
// Make punctuation smarter
jQuery.fn.smarten = (function() {
function smartenNode(node) {
if (node.nodeType === 3) {
node.data = node.data
.replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // Opening singles
.replace(/'/g, "\u2019") // Closing singles & apostrophes
.replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201c") // Opening doubles
.replace(/"/g, "\u201d") // Closing doubles
@hkfoster
hkfoster / unhover.js
Last active January 2, 2016 22:59
Disable hover events on scroll.
/**
* Disable hover events on scroll
* @see http://www.thecssninja.com/javascript/pointer-events-60fps
*/
var root = document.documentElement, timer;
window.addEventListener( 'scroll', function() {
clearTimeout( timer );