Skip to content

Instantly share code, notes, and snippets.

View americkson's full-sized avatar
😎

Adam Erickson americkson

😎
View GitHub Profile
@americkson
americkson / .gitignore
Created August 23, 2011 15:24 — forked from petemcw/.gitignore
What to ignore from Magento in Git
# Magento Connect 2 cache directories and files
downloader/pearlib/cache/
downloader/*.cfg
# Magento runtime media files
media/catalog/product/cache/
media/tmp/
media/js/
media/css/
media/.thumbs/
@americkson
americkson / gist:1165419
Created August 23, 2011 15:24 — forked from petemcw/gist:1165317
Command-line Magic

Regular Expressions

Not only useful in programming, regular expressions can make complex tasks easy in many different scenarios. Here is a great site for testing your regex:

http://rubular.com

General Shell

Run the previous command again

@americkson
americkson / gist:1173714
Last active July 8, 2019 15:49
Drupal Goodies

A collection of Drupal snippets.

Home / Front Page Tricks

Remove the Default message on home page with our creating a post

<?php if(drupal_is_front_page()) {unset($page['content']['system_main']['default_message']);} ?>
@americkson
americkson / gist:1373556
Last active April 26, 2016 19:18
Magento MAGE installer

A guide for installing modules with the MAGE installer

Magento Mage installer

Adjust permissions

Make the mage package executable

LOCAL ONLY

chmod 777 ./mage

@americkson
americkson / PHP Error ReportingDebugging
Created October 4, 2012 16:05
PHP Error Reporting/Debugging
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
@americkson
americkson / Git Ignore Changed File
Created October 8, 2012 18:47
Git Ignore Changed File
git update-index --assume-unchanged <file>
Start tracking changes again run the following command:
git update-index --no-assume-unchanged <file>
@americkson
americkson / Permission
Created October 22, 2012 23:52
Permissions
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
@americkson
americkson / Wordpress Database Move
Created February 25, 2013 15:02
Wordpress Database Move
UPDATE wp_options SET option_value = Replace(option_value, 'current-staging-domain', 'primary-domain-name');
UPDATE wp_posts SET post_content = Replace(post_content, 'current-staging-domain', 'primary-domain-name');
UPDATE wp_posts SET guid = Replace(guid, 'current-staging-domain', 'primary-domain-name');
@americkson
americkson / gist:5196021
Last active September 6, 2016 03:43
GIT - Working with branches

Create a branch:

$ git branch <name_of_your_new_branch>  

Push the branch on github :

$ git push origin <name_of_your_new_branch>  

Switch to your new branch :

@americkson
americkson / gist:5354605
Last active December 16, 2015 01:19
Random Magento Snippets

Truncate Text

truncate($STRING, $LENGTH); ?>

Ways to print attributes

  • this should work for drop downs and multi-select
getAttributeText('attribute_name'); ?>
  • this should work for text fields