Skip to content

Instantly share code, notes, and snippets.

View iods's full-sized avatar

Rye Miller iods

View GitHub Profile
@iods
iods / source.php
Created October 31, 2013 20:13
Windows IIS Compatibility for PHP Development
/** Windows IIS Compatibility */
if (!isset($_SERVER['DOCUMENT_ROOT'])) {
if (isset($_SERVER['SCRIPT_FILENAME'])) {
$_SERVER['DOCUMENT_ROOT'] = str_replace('\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0 - strlen($_SERVER['PHP_SELF'])));
}
}
if (!isset($_SERVER['DOCUMENT_ROOT'])) {
if (isset($_SERVER['PATH_TRANSLATED'])) {
$_SERVER['DOCUMENT_ROOT'] = str_replace('\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0 - strlen($_SERVER['PHP_SELF'])));
@iods
iods / basic.html
Last active November 18, 2022 03:31
Markup for boilerplate HTML files based on Acuity.
<!DOCTYPE html>
<!--[if IE 6]> <html class="ie6 no-js" lang="en-US" prefix=""><![endif]-->
<!--[if lt IE 7]> <html class="ie ie6 lte9 lte8 lte7 no-js" lang="en-US" prefix=""><![endif]-->
<!--[if IE 7]> <html class="ie ie7 lte9 lte8 lte7 no-js" lang="en-US" prefix=""> <![endif]-->
<!--[if IE 8]> <html class="ie ie8 lte9 lte8 no-js" lang="en-US" prefix=""><![endif]-->
<!--[if IE 9]> <html class="ie ie9 lte9 no-js" lang="en-US" prefix=""><![endif]-->
<!--[if gt IE 9]> <html class="gtie9 ie9 no-js" lang="en-US" prefix=""><![endif]-->
<!--[if !IE]> <html class="not-ie no-js" lang="en-US" prefix=""><![endif]-->
<head itemscope itemtype="http://schema.org/WebSite">
<meta charset="utf-8">
@iods
iods / sql-cheatsheet.sql
Last active November 18, 2022 04:43
[SQL] SQL Helpers
## create user
```sql
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
```
## grant privilages to user
```sql
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost';
@iods
iods / bash-helpers.md
Last active November 18, 2022 03:32
[DevOps] Bash Helpers

as

@iods
iods / cleanup.sql
Created August 15, 2015 00:47
Cleanup for Magento DB (Orders, Customers)
SET FOREIGN_KEY_CHECKS=0;
##############################
# SALES RELATED TABLES
##############################
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_flat_invoice`;
@iods
iods / JIRA.properties
Created September 30, 2015 22:06
JIRA Gist for Properties - Defaults
# This file contains defaults for application properties
#
# The keys must match up with the keys found in APKeys.java
#
# NB - the values in this file are not automatically
# handed to the application. The special call
# ApplicationProperties().getDefaultBackedString()
# will return the values in this file if they are not found
# in the database
@iods
iods / clearSessions.sh
Created November 28, 2015 02:02
Remove Magento sessions (file stored) in a certain specified timeframe. Run through a cron job.
#!/bin/bash
# Remove Sessions older than specified time.
DIR=/var/www/magento/var/session/
RANGE=30
/usr/bin/find $DIR -depth -mtime +$RANGE -exec rm -rf '{}' \;
@iods
iods / .gitignore
Last active July 27, 2016 15:13
Magento ignore file for past and up to v1.9.2.4
# Temp/ignore file types.
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~
@iods
iods / Observer.php
Last active November 29, 2015 03:48
Cache blocks in Magento.
<?php
/**
* Observer to core_block_abstract_to_html_before
*
* Specifies required cache information like key (block id)
* and tag (Mage_Cms_Model_Block::CACHE_TAG).
*/
public function cmsBlockCache($observer)
{
if ($block instanceof Mage_Cms_Block_Widget_Block || $block instanceof Mage_Cms_Block_Block)
@iods
iods / DOCTYPE.html
Last active November 18, 2022 04:44
My sections of marking up an HTML page.
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--><!-- Le fav and touch icons -->