Skip to content

Instantly share code, notes, and snippets.

View petemcw's full-sized avatar

Pete McWilliams petemcw

View GitHub Profile
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#
# Include all files from the config directory
#
@petemcw
petemcw / local.xml
Last active August 29, 2015 14:24
Basic Magento Redis Configuration
<?xml version="1.0"?>
<!--
/**
* Magento Enterprise Edition
*
* NOTICE OF LICENSE
*
* This source file is subject to the Magento Enterprise Edition End User License Agreement
* that is bundled with this package in the file LICENSE_EE.txt.
* It is also available through the world-wide-web at this URL:
@petemcw
petemcw / .gitignore
Created December 16, 2010 18:24
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/
@petemcw
petemcw / key_generator.rb
Created April 27, 2011 15:16
Random Key Generator
class KeyGenerator
require "digest/sha1"
def self.generate(length = 12)
Digest::SHA1.hexdigest(Time.now.to_s + rand(567891234).to_s)[1..length]
end
end
@petemcw
petemcw / gist:1165317
Created August 23, 2011 14:48
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

@petemcw
petemcw / vhost.conf
Created August 31, 2011 14:33
Sample Apache vhost Configuration File
<VirtualHost *:80>
DocumentRoot "/path/to/web/files/"
ServerAdmin webmaster@localhost
ServerName localhost
#SetEnv MAGE_IS_DEVELOPER_MODE true
#SetEnv MAGE_RUN_CODE storecode
#SetEnv MAGE_RUN_TYPE website
<Directory "/path/to/web/files/">
@petemcw
petemcw / gist:1201928
Created September 7, 2011 22:04
MySQL user creation
GRANT USAGE ON *.* TO `user`@`localhost` IDENTIFIED BY 'password';
GRANT CREATE ROUTINE, CREATE VIEW, ALTER, SHOW VIEW, CREATE, ALTER ROUTINE, INSERT, SELECT, DELETE, UPDATE, DROP, LOCK TABLES, CREATE TEMPORARY TABLES, INDEX ON `database`.* TO `user`@`localhost` IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
@petemcw
petemcw / gist:2719758
Created May 17, 2012 15:53
Commands to clean a Ubuntu install for smaller Vagrant packages
# Remove items used for building, since they aren't needed anymore
apt-get clean
apt-get -y remove linux-headers-$(uname -r) build-essential
apt-get -y autoremove
# Zero out the free space to save space in the final image:
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
# Removing leftover leases and persistent rules
@petemcw
petemcw / gist:1427528
Created December 3, 2011 16:41
Re-order Magento Categories Alphabetically
SET @position = 0;
SET @last_parent = 0;
SET @last_level = 0;
DROP TABLE IF EXISTS `cce_new_position`;
CREATE TEMPORARY TABLE `cce_new_position`
SELECT
`new`.`entity_id` AS `entity_id`,
`new`.`parent_id` AS `parent_id`,
@last_parent := CAST(`new`.`parent_id` AS UNSIGNED) AS `new_parent_id`,
`new`.`name` AS `name`,
@petemcw
petemcw / gist:a3292cb65851ecfc0e26
Created June 10, 2014 20:43
Quick cheat sheet for merging two separate repositories while retaining commit history.
#
# Basic process for merging two Git repositories while retaining commit history.
# - This seems to work pretty well for migrations to Pantheon
#
# Clone the repository that will be the final origin
git clone <repository_uri_1> <local_dir>
cd <local_dir>
# Add the second repository as a remote