Skip to content

Instantly share code, notes, and snippets.

View geekwho-eth's full-sized avatar

Geek Who geekwho-eth

View GitHub Profile

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@geekwho-eth
geekwho-eth / proxy_nginx.sh
Created May 24, 2012 07:24 — forked from rdegges/proxy_nginx.sh
Create a HTTP proxy for jenkins using NGINX.
sudo aptitude -y install nginx
cd /etc/nginx/sites-available
sudo rm default
sudo cat > jenkins
upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
@geekwho-eth
geekwho-eth / gist:2780014
Created May 24, 2012 07:25 — 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
##Get product image##
<?php
<?php
//get import resource helper
$helper = Mage::getResourceHelper('importexport');
//get next auto increment id
$res = Mage::getSingleton('core/resource');
$readConnection = $res->getConnection('core_read');
$table = $res->getTableName('catalog_product_entity');
$id = Mage::getResourceHelper('importexport')->getNextAutoincrement("{$table}");
@geekwho-eth
geekwho-eth / Fooman Speedster 2 nginx rewrite rule
Created June 5, 2012 02:57
Fooman Speedster nginx rewrite rule
#for Fooman Speedster 2 nginx rewrite rule
location /skin/m/ {
rewrite ^/skin/m/([^/]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1;
}
@geekwho-eth
geekwho-eth / purge-cache.sh
Created November 12, 2012 03:26 — forked from cosimo/purge-cache.sh
Script to purge varnish cache by URL, by regexp or all of it (for Debian)
#!/bin/sh
# purge-cache: Script to purge varnish cache. Defaults are defined in
# /etc/default/varnish.
#
# Cosimo <[email protected]>
# Based on reload-vcl, by Stig Sandbeck Mathisen <ssm at debian dot org>
# Settings
defaults=/etc/default/varnish
@geekwho-eth
geekwho-eth / purge-cache.sh
Created November 12, 2012 03:26 — forked from cosimo/purge-cache.sh
Script to purge varnish cache by URL, by regexp or all of it (for Debian)
#!/bin/sh
# purge-cache: Script to purge varnish cache. Defaults are defined in
# /etc/default/varnish.
#
# Cosimo <[email protected]>
# Based on reload-vcl, by Stig Sandbeck Mathisen <ssm at debian dot org>
# Settings
defaults=/etc/default/varnish
@geekwho-eth
geekwho-eth / mono.rb
Created November 11, 2013 15:27 — forked from shtirlic/mono.rb
# http://www.mono-project.com/Compiling_Mono_on_OSX
require 'formula'
class Mono < Formula
#url 'http://download.mono-project.com/sources/mono/mono-3.0.6.tar.bz2'
#sha1 'e2187f80366fcd65c55a1ab946f8d3b39e81be77'
url 'http://download.mono-project.com/sources/mono/mono-2.10.9.tar.bz2'
sha1 '1a6e8c5a0c3d88d87982259aa04402e028a283de'
<?php
require_once 'app/Mage.php';
Mage::app();
$quote = Mage::getModel('sales/quote')
->setStoreId(Mage::app()->getStore('default')->getId());
$product = Mage::getModel('catalog/product')->load(6); /* 6 => Some product ID */

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after