Skip to content

Instantly share code, notes, and snippets.

View mschultheiss83's full-sized avatar

Martin Schultheiß mschultheiss83

View GitHub Profile
use your_databasse;
set @attribute_code = 'name';
set @entity_type_id = '4';
set @entity_id = '502';
set @backend_type =
(select backend_type
from eav_attribute
where attribute_code = @attribute_code and
@mschultheiss83
mschultheiss83 / gist:5341885
Created April 9, 2013 00:29 — forked from guipdutra/gist:5341767
git log pretty format
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
@mschultheiss83
mschultheiss83 / gist:5341886
Created April 9, 2013 00:29 — forked from guipdutra/gist:5341767
git log pretty format
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
@mschultheiss83
mschultheiss83 / gist:5341888
Created April 9, 2013 00:30 — forked from guipdutra/gist:5341767
git log pretty format
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

Debugging (Resource) Model Instantiation

Follow each step manually and any bugs during (resource) model instantiation will become obvious.

Since many people find model and resource model instantiation to be one of the more challenging things in Magento 1, these are all the steps Magento does to resolve the factory name to the real PHP class name.

To debug, simply follow each step manually until you find a non-match. This works really well in my experience.
Less guessing, more and faster results.

In the examples I use a factory name of "example/thing".

<?php
/**
* Input string parser that keeps variable keys in their original state.
*
* Input string keys containing '-','.',' ' are replaced by PHP with parse_str or $_POST
* with '_'. So &I+have+a+space=value becomes array('I_hava_a_space'=>'value')
*
* With InputStrParser->parseCharacterSafe('I+have+a+space=value') becomes
* array('I hava a space'=>'value')
*
...
location ~ .php$ {
...
## Magento 2 Developer mode
fastcgi_param MAGE_MODE "developer";
...
}
...
server {
set $domain 'yourdomain.com';
server_name $domain;
root /home/$domain/public;
access_log /home/$domain/logs/access.log;
error_log /home/$domain/logs/error.log;
# Cache static files for as long as possible
location ~* \.(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ {
try_files $uri =404;

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables