Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jonmunson's full-sized avatar

Jon Munson jonmunson

View GitHub Profile
<?php wp_footer(); ?>
<?php if (!$user_ID) : ?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9669661-12']);
_gaq.push(['_trackPageview']);

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

/**
* 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 / _ie8-grid-fix
Last active December 24, 2015 21:49 — forked from tmayr/gist:5190565
ZURB Foundation 4 - IE8 Fixes
/* The Grid ---------------------- */
.lt-ie9 .row { width: 940px; max-width: 100%; min-width: 768px; margin: 0 auto; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row.large-collapse .column,
.lt-ie9 .row.large-collapse .columns { padding: 0; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row .row.large-collapse { margin: 0; }
.lt-ie9 .column, .lt-ie9 .columns { float: left; min-height: 1px; padding: 0 15px; position: relative; }
.lt-ie9 .column.large-centered, .columns.large-centered { float: none; margin: 0 auto; }
@jonmunson
jonmunson / prefetchbuilder.js
Created December 3, 2015 22:23 — forked from PaulKinlan/prefetchbuilder.js
Code to return link rel=dnsprefetch
(function() {
var requests = window.performance.getEntries();
var hosts = {};
var output = "";
for(var requestIdx = 0; requestIdx < requests.length; requestIdx++) {
var request = requests[requestIdx];
var origin = new URL(request.name).origin;
hosts[origin] = 1;
TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
@jonmunson
jonmunson / permission.sh
Last active August 29, 2015 14:27 — forked from carlosasin/permission.sh
Magento - Repair permissions
#!/bin/sh
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;
sudo chmod o+w var app/etc
sudo chmod 550 mage
sudo chmod -R o+w media
@jonmunson
jonmunson / .gitignore
Last active August 29, 2015 14:27 — forked from carlosasin/.gitignore
Git ignore Magento (ignore .htaccess for NGINX)
# Ignore PHPStorm
/.idea/
/.phpstorm.meta.php
#Ignore vagrant
/.vagrant/
# Ignore code coverage reports
/build/
@jonmunson
jonmunson / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jonmunson
jonmunson / 1. Example.scss
Last active August 29, 2015 14:00 — forked from Integralist/1. Example.scss
Example of CSS Animation with keyframes
@include keyframe(fadeout) {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}