Skip to content

Instantly share code, notes, and snippets.

View heyfletch's full-sized avatar
🏠
Working from home

Joe Fletcher heyfletch

🏠
Working from home
View GitHub Profile
@heyfletch
heyfletch / MageMonkeySubscribe.phtml
Created April 17, 2012 19:05
MageMonkeySubscribe.phtml with some fixes to prevent javascript errors, but does not actually subscribe customer
<?php
$check = $this->checkStatus();
$auto = (($check === 1) OR ($check === 3));
?>
<script type="text/javascript">
addSubscribeToPost = function (element)
{
if($('magemonkey-subscribe'))
{
$('magemonkey-subscribe').remove();
@heyfletch
heyfletch / findit.sh
Created October 13, 2012 21:10
Bash Command / Bashrc Function to find any occurrence of a key phrase in files or filepaths
function findit() {
{ mlfind . -iname "*$1*";
grep -irl "$1" .
} | sort -u
}
export -f findit
# Returns a list of filepaths where the key phrase occurs.
# Case insensitive
# Usage:
@heyfletch
heyfletch / custom_options_layout_update.xml
Created December 14, 2012 18:18
Custom Color Options Magento Extension by Temgra
<reference name="head">
<action method="addJs"><script>temgra/colorCustomOptions.js</script></action>
<action method="addItem"><type>skin_css</type><name>css/colorCustomOptions.css</name></action>
</reference>
<reference name="content">
<remove name="product.info.addto" /><!-- optional -->
</reference>
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/view-custom.phtml</template></action>
</reference>
@heyfletch
heyfletch / highlight.html
Created August 29, 2013 19:55
Highlight another element when clicking a certain hyperlink or element
<a class="highlight" href="#myIDorClass">AnchorText</a>
<script>
jQuery(".highlight").on("click", function(){
jQuery("#myIDorClass").css({'background':'yellow'});
});
</script>
@heyfletch
heyfletch / .gitignore
Created March 28, 2014 04:36
.gitignore for local development with WP Engine, Grunt, Sass, and common plugins
Thumbs.db
Desktop.ini
_notes
.svn
.project
.idea/
.DS_Store
.cvs
*~
*.tmproj
@heyfletch
heyfletch / 0_reuse_code.js
Created June 18, 2014 19:52
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
@heyfletch
heyfletch / website-build.md
Last active August 29, 2015 14:04
Website Build Ingredients
  • matchmedia: testing whether or not a media query applies with Javascript
  • picturefill: switch image sizes / hidpi / retina (includes matchmedia?)
  • Gulp or Grunt: build system / task runner
  • NPM: node package manager
  • composer: PHP package manager
  • bower: JS package manager
  • autoprefixer: add browser prefixes
  • cssmin: minify and concatenate CSS
  • imagemin: lossless image compression
  • spritesmith: create sprites
@heyfletch
heyfletch / sticky-footer.css
Last active August 29, 2015 14:11
Sticky Footer
@heyfletch
heyfletch / gppm.bash
Last active August 29, 2015 14:16
Push to WP Engine
## Push to WP Engine
function gppm() {
# check if we are in a git repository
if git rev-parse --git-dir > /dev/null 2>&1; then
# check if there any untracked files that need to be commited.
git ls-files --exclude-standard --others --error-unmatch . >/dev/null 2>&1; ec=$?
if test "$ec" = 0; then
echo
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro
#
WP_OWNER=web # -- wordpress owner
WP_GROUP=www-data # -- wordpress group
WP_ROOT=/srv/www/webproguru/project/web # -- wordpress root directory