Skip to content

Instantly share code, notes, and snippets.

View jonmunson's full-sized avatar

Jon Munson jonmunson

View GitHub Profile
@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 / 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 / vertical-align.scss
Created June 23, 2015 10:05
Vertical align anything with just 3 lines of CSS
// Source: http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/
/* Mixin */
@mixin vertical-align {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
@jonmunson
jonmunson / mysqldump-remote.sh
Created March 9, 2015 21:55
mysqldump all databases from remote host
mysqldump -h 1.2.3.4 -u username -p --all-databases > database_backup.sql
@jonmunson
jonmunson / wget-ftp.sh
Last active August 29, 2015 14:16
wget command to download directory via ftp
wget -m --user=yourusername --password=yourpassword ftp://www.ftphost.co.uk:21/directory/
@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 / foundation5-accordion-animate.html
Created February 11, 2015 09:42
Foundation5 Accordion - Animate open/close with js
<script src="/bower_components/foundation/js/foundation/foundation.accordion.js"></script>
<script>
//reflow after page load
$(document).foundation('accordion', 'reflow');
//animate open/close
$(".accordion dd").on("click", "a:eq(0)", function (event) {
var dd_parent = $(this).parent();
@jonmunson
jonmunson / retina-background-images.scss
Created November 25, 2014 09:50
Mixin for Retina background images
@mixin background-img ($img,$ext) {
background-image: url($img+'.'+$ext);
@media (-webkit-min-device-pixel-ratio: 2), (-moz-min-device-pixel-ratio: 2) {
&{ background-image: url($img + '@2x.' + $ext); }
}
}
@jonmunson
jonmunson / fonts.scss
Created November 20, 2014 12:15
Usage of Compass font-face mixin
@include font-face("AvenirNext-Regular", font-files("AvenirNext-Regular/AvenirNext-Regular.ttf", "AvenirNext-Regular/AvenirNext-Regular.otf"), "AvenirNext-Regular/AvenirNext-Regular.eot");
@include font-face("ChaparralPro-Italic", font-files("ChaparralPro-Italic/ChaparralPro-Italic.ttf", "ChaparralPro-Italic/ChaparralPro-Italic.otf"), "ChaparralPro-Italic/ChaparralPro-Italic.eot");
// For font path issues with this mixin, check this out:
// https://stackoverflow.com/questions/17734459/what-is-wrong-with-my-use-of-the-compass-font-face-mi
@jonmunson
jonmunson / detect-mobile.js
Created October 14, 2014 13:38
Detect Mobile device with 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);
},