Skip to content

Instantly share code, notes, and snippets.

View thejohnsmith's full-sized avatar
💭
I may be slow to respond.

John Smith thejohnsmith

💭
I may be slow to respond.
View GitHub Profile
/*!
* jQuery Tiny Pub/Sub - v0.X - 11/18/2010
* http://benalman.com/
*
* Original Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* Made awesome by Rick Waldron
*
@zachleat
zachleat / gist:2008932
Created March 9, 2012 21:56
Prevent zoom on focus
// * iOS zooms on form element focus. This script prevents that behavior.
// * <meta name="viewport" content="width=device-width,initial-scale=1">
// If you dynamically add a maximum-scale where no default exists,
// the value persists on the page even after removed from viewport.content.
// So if no maximum-scale is set, adds maximum-scale=10 on blur.
// If maximum-scale is set, reuses that original value.
// * <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=2.0,maximum-scale=1.0">
// second maximum-scale declaration will take precedence.
// * Will respect original maximum-scale, if set.
// * Works with int or float scale values.
@prettycode
prettycode / textarea-maxlength.ie.shim.js
Last active August 23, 2023 14:48
jQuery shim for supporting <textarea> "maxlength" attribute in IE < 10.
// jQuery shim for supporting <textarea> `maxlength` attribute in IE < 10
// Author: Chris O'Brien, prettycode.org
// License: MIT
(function ($) {
// Target only IE browsers that don't support `maxlength`
if (typeof document.selection === 'undefined' ||
'maxLength' in document.createElement('textarea')
@jasdeepkhalsa
jasdeepkhalsa / jquery.center.js
Created June 5, 2013 16:49
Center function for jQuery
jQuery.fn.center = function() {
this.css({
'position': 'fixed',
'left': '50%',
'top': '50%'
});
this.css({
'margin-left': -this.outerWidth() / 2 + 'px',
'margin-top': -this.outerHeight() / 2 + 'px'
});
@joaocunha
joaocunha / How To Hide The Select Arrow On Firefox.md
Last active December 10, 2023 13:05
How to hide <select> dropdown's arrow in Firefox when using "-moz-appearance: none;".

This is no longer a bug. I'm keeping the gist for historical reasons, as it helped to get it fixed. Make sure to read the notes by the end of the post.

How to remove hide the select arrow in Firefox using -moz-appearance:none;

TL;DR (or, the fix)

  1. Set -moz-appearance to none. This will "reset" the styling of the element;
  2. Set text-indent to 0.01px. This will "push" the text a tiny bit[1] to the right;
@chamoysvoice
chamoysvoice / jsonview-monokai.css
Last active December 6, 2018 17:46
JSON View monokai theme for Chrome Extension
body {
white-space: pre;
font-family: monospace;
font-size: 1.2em; /* I like big fonts, if you don't remove this line */
background: #272822;
color: #f8f8f2;
}
.property {
font-weight: auto;