Skip to content

Instantly share code, notes, and snippets.

@philwinkle
philwinkle / gist:6159910
Created August 5, 2013 21:48
Keyboard Cleaning 8-2013
hyreasZLOAS tyuiop0;ewqe=[]
['phn['
]'[l.:"
}p[;?.≤gbfcxcfghgcvvghcv xcvbjnbvcxhbnvc ΩcfvxzsedsazaswaASWA qasdesaAQWEWQA qwertuuhgfdsehk;'
]\\
']\\
]\]\]=]=p0[-==p0-o9i890-p0o9u7u7w2e34rq1 `12wq1 `
?
'/.;'
alias sshkey="cat ~/.ssh/id_rsa.pub | pbcopy && echo 'Copied to clipboard.'"
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
# So, you forgot to use logrotate and now you're staring at a 30GB system
# log on your production server.
# Never fear...
# Tail an arbitrarily large number of bytes off the end of the thing.
# This example takes approximately the last 5GB.
tail -c 5000000000 system.log > ~/system.log.tmp
# But, we only want the last month of log data. Let's find the line number
# where this month's reporting starts.
<?php
class Marty_Package_Helper_Data extends Mage_Core_Helper_Abstract
{
public function getYesnoHtml()
{
$options = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
delimiter ;;
drop procedure if exists build_catalog;;
create procedure build_catalog(IN categories INT, IN products INT)
begin
SET @category_count = 1;
SET @CATNAMEPREFIX = "Category ";
SET @CATURLKEYPREFIX = "cat-";
SET @CATURLPATHPREFIX = "catpath-";
SET @ROOTCATEGORY = 2;
SET @INCLUDEINMENU = 1;
explain(){ curl -s $(echo "http://explainshell.com/explain/$1?args=${@:2}" | sed -e 's/ /+/g') |
sed -n '/<pre/,/<\/pre>/p' | sed -s 's/<[^>]*>//g' | sed -e 's/^ *//g;s/ *$//g' | grep '.' | cat }
delimiter ;;
drop procedure if exists build_catalog;;
create procedure build_catalog(IN categories INT, IN products INT)
begin
SET @category_count = 1;
SET @CATNAMEPREFIX = "Category ";
SET @CATURLKEYPREFIX = "cat-";
SET @CATURLPATHPREFIX = "catpath-";
SET @ROOTCATEGORY = 2;
SET @INCLUDEINMENU = 1;
@philwinkle
philwinkle / closures.php
Created September 11, 2013 17:14
Closures and Mage::register
<?php
#file: closures.php
require('app/Mage.php');
Mage::app();
//testing Mage::registry closure support
Mage::register('testing',function($v){
@philwinkle
philwinkle / example.php
Last active December 22, 2015 20:59
Load product collection by IDs
<?php
$ids = array(1,2,3,4);
//DON'T DO THIS
foreach($ids as $id){
Mage::getModel('catalog/product')->load($id);
}