Skip to content

Instantly share code, notes, and snippets.

@roscius
roscius / git_remote_branches.sh
Created May 20, 2012 20:12 — forked from thisivan/git_remote_branches.sh
Git: Track Remote Branches
# Create new remote branch
git push origin origin:refs/heads/new_branch_name
# Make sure everything is updated
git fetch origin
# Check your branch has been created
git branch -r
# Track a remote branch
@roscius
roscius / gist:3739457
Created September 17, 2012 20:05 — forked from davidalexander/gist:1086455
Magento Snippets

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@roscius
roscius / phpdate.php
Created November 5, 2012 15:15
PHP Date Functions
date_default_timezone_set ( 'America/Vancouver' );
date('Y-m-d H:i:s'); // 2012-11-30 00:00:00 using current timestamp (second optional arg)
@roscius
roscius / gist:5178934
Last active December 15, 2015 01:19
Magento Form Validation Classes

Magento client-size JS CSS classes and error messages

These css classes are used by the Prototype JS libarary in Magento for client side validation.

validate-select

Please select an option.

required-entry

Create a New Self Signed SSL Certificate
===
`openssl req -x509 -nodes -days 1024 -newkey rsa:2048 -keyout mysite.key -out mysite.crt`
@roscius
roscius / MagentoDB.php
Created May 8, 2013 17:50
Magento DB Functions
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$results = $readConnection->fetchCol('SELECT somecolumn FROM sometable');
foreach ($results as $result) {
echo $result;
}
<?php
/**
* Drop this into the shell directory in the Magento root and run with -h to see all options.
*/
require_once 'abstract.php';
/**
* Fix duplicate url keys for categories and products to work with the 1.8 alpha1 CE url key constraints.

Install Gearman and Supervisor on Ubuntu 12.04

Download the latest version of Gearman from: https://launchpad.net/gearmand/

Add required libraries:

apt-get install build-essential libboost-thread-dev libboost-program-options-dev libevent-dev libcloog-ppl0 libmysqld-dev uuid-dev -y

Build Gearman:

@roscius
roscius / gist:6126250
Created July 31, 2013 21:14
CSR Generation
openssl req -new -newkey rsa:2048 -nodes -keyout mydomain.key -out mydomain.csr
@roscius
roscius / gist:7326375
Last active December 27, 2015 12:29
Set up MySQL slave

ON THE MASTER:

Ensure that ports are open on master (3306)

In my.cnf set

bind-address = xx.xx.xx.xx

or use