Skip to content

Instantly share code, notes, and snippets.

@neogeek
Last active August 29, 2015 13:56
Show Gist options
  • Save neogeek/8895506 to your computer and use it in GitHub Desktop.
Save neogeek/8895506 to your computer and use it in GitHub Desktop.
Cheat Sheet

#Cheat Sheet

##Table of Contents

###ImageMagick

###JavaScript

###CSS

##ImageMagick

###Batch Convert

mogrify -format png *.gif

##JavaScript

###Bubble Sort

obj = Array.prototype.slice.call(obj).sort(function (a, b) {
    return a.id > b.id ? 1 : -1;
});

###Event Bubbling

Use mouseenter and mouseleave on a parent object rather than mouseover and mouseout to prevent child nodes from firing mouseout.

elem.addEventListener('mouseenter', function () {
    // show element
});
elem.addEventListener('mouseleave', function () {
    // hide element
});

##CSS

###Background Clipping

.elem {
    -webkit-background-clip: padding-box;
    -moz-background-clip: padding-box;
    background-clip: padding-box;
}

###Box Sizing

.elem {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

###Change Selection Color

::selection { background: rgba(0, 255, 255, 0.15); }
::-moz-selection { background: rgba(0, 255, 255, 0.15); }

###Disable Selection of Text

.elem {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

###Remove Extra Padding on Buttons in Firefox

button::-moz-focus-inner {
    border: 0;
    padding: 0;
}

###Text Rendering

.elem { text-rendering: optimizeLegibility; }

###Font Smoothing

.elem { -webkit-font-smoothing: antialiased; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment