Skip to content

Instantly share code, notes, and snippets.

@redesigned
redesigned / mod_security
Created September 18, 2013 11:19
mod_security
Troubleshooting Mod_Security 2.5:
The first step is to identify which rule is blocking your users or breaking your site. To see what is happening, check your Apache Error log or your Mod_Security log. In your logs, you will see something like this:
Pattern match "(?:cd |\;|php |echo |perl |killall |python |rpm |yum |apt-get |emerge |lynx |links |mkdir |elinks |wget |lwp-(?:download|request|mirror|rget) |id|uname |cvs |svn |(?:s|r)(?:cp|sh) |net(?:stat|cat) |rexec |smbclient |t?ftp |ncftp |curl |telnet |g?cc |cp ..." at REQUEST_URI. [file "/etc/modsecurity/10_asl_rules.conf"]
[line "587"] [id "340037"] [rev "3"] [msg "Atomicorp.com - FREE UNSUPPORTED DELAYED FEED - WAF Rules: Generic command injection"] [severity "CRITICAL"]
yoursite.com 81.99.13.12 340037 [07/Jan/2011:22:43:29 --0800]
Pattern match "(?:cd |\;|php |echo |perl |killall |python |rpm |yum |apt-get |emerge |lynx |links |mkdir |elinks |wget |lwp-(?:download|request|mirror|rget) |id|uname |cvs |svn |(?:s|r)(?:cp|sh) |net(?:stat|cat) |rexec |smbclie
@redesigned
redesigned / magento_logging
Created September 22, 2013 02:53
Magento Logging
#Log to your own logfile
Mage::log('My log entry', null, 'mylogfile.log');
#Log to the system logfile
Mage::log('My log entry');
#Log to the exception logfile
Mage::logException($e);
@redesigned
redesigned / email_addresses.php
Created October 30, 2013 08:22
Magento - Getting Store Email Addresses
/* #### General Contact #### */
/* Sender Name */
Mage::getStoreConfig('trans_email/ident_general/name');
/* Sender Email */
Mage::getStoreConfig('trans_email/ident_general/email');
/* #### Sales Representative #### */
/* Sender Name */
Mage::getStoreConfig('trans_email/ident_sales/name');
/* Sender Email */
@redesigned
redesigned / lists
Created October 30, 2013 09:05
Lists
/* ## Image Bullets ## */
.my-list { list-style-image: url('./images/bullet.png'); }
/* ## Default Styles Reset ## */
.std ol li { list-style: decimal outside none; display: list-item; margin-left: 1em; }
.std ul li { list-style: disc outside none; display: list-item; margin-left: 1em; }
@redesigned
redesigned / tips.txt
Last active December 27, 2015 01:19
Magento Editing Tips
Editing Tips:
When editing any CMS Static Block or CMS Page, I highly recommend first clicking the button to hide the WYSIWYG editor, and copying all the existing code out to a safe location, that way you have a back up in case your edits go awry or mess up the page somehow. Then click the button to reenable the WYSIWYG editor and make your edits and save. Refresh the corresponding frontend page in your browser to make sure everything looks good. If you need to restore the page/block due to some error/glitch/problem simply re-edit that page/block, hide the WYSIWYG and copy the code you saved in your safe location back in and resave the page/block and everything will be back to how it was before your edit.
When editing formatted content it is better to click into that content and use the keyboard to delete and type the new content rather they select highlighting and typing. Same with editing links, it is better to click into them and click the link button or edit the text rather then select highlighting
@redesigned
redesigned / hacks.css
Created November 5, 2013 22:00
CSS Hacks
/* ### IE 8, 9, and 10 ### */
@media screen\0 { body { background: #F00; } }
@redesigned
redesigned / .htaccess
Created November 13, 2013 06:07
Magento Website and Theme Switching
#### Set the website based on the domain name ####
SetEvnIf Host ^www\.domain1\.com$ MAGE_RUN_CODE=website_one_code MAGE_RUN_TYPE=website
SetEvnIf Host ^www\.domain1\.com$ MAGE_RUN_CODE=website_two_code MAGE_RUN_TYPE=website
@redesigned
redesigned / basic_commands
Last active January 12, 2017 19:44
Terminal / Shell Shortcuts
pwd (personal working directory)
cd (change directory)
mkdir (make directory)
⌘k (clear screen)
clear (clear screen)
ls (list directory)
touch (set times or create files)
rm (remove)
all osx commands: http://ss64.com/osx/
@redesigned
redesigned / illustrator_for_web
Created December 10, 2013 22:03
Illustrator for web
Basically, besides the colors set to RGB and the units to pixels, when the illustrator document is created, you need to make sure that the Snap to Pixel Grid box is checked, and whenever you transform or move an object you want that box checked as well.
Since illustrator is vector, paths can potentially be placed any fraction of a pixel off and will create lots of extra feathered borders, blurriness, stair stepping on curves, squares and boxes with blurred corners, fuzzy fonts, wrong font weights, and host of other unwanted issues due to them not being aligned to the pixel grid properly. Basically, that one setting of snapping to pixel grid increases the quality of the output for web tremendously.
Make sure to follow all of these tips:
http://help.adobe.com/en_US/illustrator/cs/using/WSf01dbd23413dda0e1e23acb6124476da654-7fea.html
This is the shortlist for illustrator web pixel perfection.
1. RGB Color
2. Font Rendering set to Sharp
@redesigned
redesigned / Apache Cert Install
Created September 20, 2017 01:00
AWS LetsEncrypt
# Apache Setup
<VirtualHost *:80 *:443>
ServerName domainname.com
ServerAlias www.domainname.com
DocumentRoot /efs/html/domainname.com
ErrorLog /efs/html/logs/domainname.com/error_log
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/domainname.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domainname.com/privkey.pem
<Directory /efs/html/domainname.com>