Skip to content

Instantly share code, notes, and snippets.

Avatar

Jon Munson jonmunson

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am jonmunson on github.
  • I am jonmunson (https://keybase.io/jonmunson) on keybase.
  • I have a public key ASCyXh8bPuIdNQf08yXQY7WH9bC4O-PwzV101feiryxXAgo

To claim this, I am signing this object:

@jonmunson
jonmunson / apache2.conf
Created Apr 16, 2017
Apache2 settings for optimum security - /etc/apache2/apache2.conf
View apache2.conf
<Directory /var/www/>
Options FollowSymLinks
AllowOverride None
Require all granted
Header always append X-Frame-Options SAMEORIGIN
Header set X-XSS-Protection "1; mode=block"
Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
FileETag None
RewriteEngine On
RewriteCond %{THE_REQUEST} !HTTP/1\.1$
@jonmunson
jonmunson / detect-mobile.js
Created Oct 14, 2014
Detect Mobile device with JS
View detect-mobile.js
//------------------------------------------------------------------------------
//Detect iPhone, iPod, iPad or mobile device
//------------------------------------------------------------------------------
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
View ga-not-track-logged-in-users.php
<?php wp_footer(); ?>
<?php if (!$user_ID) : ?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9669661-12']);
_gaq.push(['_trackPageview']);
View hide-select-arrow-firefox.md

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

Background

I was experimenting on custom styling the <select> elements of a form I was building. One of the things I tried implementing was truncating the text with an ellipsis in case it extended beyond the <select>'s width. It didn't look consistent through browsers, but I've accidentally discovered something really nice.

The bug

@jonmunson
jonmunson / orbit-custom-nav.css
Created Dec 9, 2013
Zurb Orbit custom navigation styles - My solution in F5 was to create new completely separate buttons (".next-slide" and ".prev-slide"), and then trigger the existing functionality with some JS overrides.
View orbit-custom-nav.css
/* hide the built in controls */
.orbit-container .orbit-prev, .orbit-container .orbit-next {display: none;}
@jonmunson
jonmunson / checkbox-validate.js
Created Nov 4, 2013
Validation script to determine a "checkbox" state
View checkbox-validate.js
//Validation for Sponsor in Application Edit/Show
function validate(){
var hasSponsor = document.getElementById('hasSponsor'); //check box ID
if (hasSponsor.checked){
sponsorUrl = document.getElementById('sponsorUrl'); //sponsor URL field ID
sponsorImage = document.getElementById('sponsorImage'); //sponsor Image field ID
View relativePath.js
/**
* Given a source directory and a target filename, return the relative
* file path from source to target.
* @param source {String} directory path to start from for traversal
* @param target {String} directory path and filename to seek from source
* @return Relative path (e.g. "../../style.css") as {String}
*/
function getRelativePath(source, target) {
var sep = (source.indexOf("/") !== -1) ? "/" : "\\",
targetArr = target.split(sep),
@jonmunson
jonmunson / phonegap-flicker.css
Created Oct 31, 2013
PhoneGap - fix flickering issue by forcing use of hardware accelleration
View phonegap-flicker.css
.scrollArea {
-webkit-transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
-webkit-perspective: 1000;
}
@jonmunson
jonmunson / tinymce-disable-certain-textarea.js
Created Oct 18, 2013
TinyMCE - disable the WYSIWYG editor on <textarea> with a specific class
View tinymce-disable-certain-textarea.js
selector: "textarea", // Select all textarea
selector: "textarea.editme", // Select all textarea with the class editme
selector : "textarea:not(.mceNoEditor)", // Select all textarea exluding the mceNoEditor class
You can’t perform that action at this time.