Skip to content

Instantly share code, notes, and snippets.

View tegansnyder's full-sized avatar
💭
Stay'n cold in Minnesota

Tegan Snyder tegansnyder

💭
Stay'n cold in Minnesota
View GitHub Profile
@tegansnyder
tegansnyder / httpd.conf
Last active April 7, 2021 00:41
Example of bringing Magento's .htaccess file into your Apache http.conf file.
#NameVirtualHost *:80
<VirtualHost *:80>
ServerName "www.domain.com"
ServerAlias domain.com
ErrorLog logs/error_log
TransferLog logs/access_log
LogLevel warn
ServerAdmin admin@domain.com
DocumentRoot /sites/magento
DirectoryIndex index.php index.html
@tegansnyder
tegansnyder / .htaccess
Created September 18, 2013 14:17
Example .htaccess file with proper expiry headers set for google page speed test. Everything else is commented out and merged into the httpd.conf file for speed see: https://gist.github.com/tegansnyder/6609688
############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi
# Action php5-cgi /cgi-bin/php5-cgi
# AddHandler php5-cgi .php
DirectoryIndex index.php
@tegansnyder
tegansnyder / example-varnish.vcl
Created September 18, 2013 15:52
Example VCL for Magento and Varnish using Turpentine
C{
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <pthread.h>
static pthread_mutex_t lrand_mutex = PTHREAD_MUTEX_INITIALIZER;
void generate_uuid(char* buf) {
pthread_mutex_lock(&lrand_mutex);
long a = lrand48();
long b = lrand48();
@tegansnyder
tegansnyder / ImportCustomersMagento.php
Created November 4, 2013 20:57
Import a list of customers into Magento from a CSV while generating a random password.
<?php
require_once('app/Mage.php');
umask(0);
Mage::app();
$customer = Mage::getModel('customer/customer');
$csv = array();
@tegansnyder
tegansnyder / ImportCustomerGroups.php
Last active December 27, 2015 10:18
Importing a list of customer groups into Magento from a CSV file.
<?php
equire_once('app/Mage.php');
umask(0);
Mage::app();
$customer = Mage::getModel('customer/customer');
$csv = array();
C{
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <pthread.h>
static pthread_mutex_t lrand_mutex = PTHREAD_MUTEX_INITIALIZER;
void generate_uuid(char* buf) {
pthread_mutex_lock(&lrand_mutex);
long a = lrand48();
long b = lrand48();
@tegansnyder
tegansnyder / add-new-customer-with-custom-welcome-email.php
Created November 11, 2013 16:01
An example of adding a new customer to Magento with a auto-generated password and custom welcome email.
<?php
// sending a custom password to customers
require_once('app/Mage.php');
umask(0);
Mage::app();
$store_id = Mage::app()->getStore()->getId();
location ~ ^/_intellij_phpunit_launcher.php$ {
expires off; ## Do not cache dynamic content
set $args "$args&dir=$document_root&config=phpunit.xml.dist";
fastcgi_pass unix://var/run/php5-fpm.sock; # Replace with your fpm pass
fastcgi_read_timeout 600;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
@tegansnyder
tegansnyder / Magent_Product_Category_Query.sql
Created December 6, 2013 16:47
Query to retrieve all product ids and the category they belong to in Magento.
SELECT `e`.entity_id, `at_category_id`.`category_id`
FROM `catalog_product_entity` AS `e`
LEFT JOIN `catalog_category_product` AS `at_category_id`
ON (at_category_id.`product_id`=e.entity_id)

Running Magento Enterprise Edition with Facebook HipHop HHVM

Prerequisites

Hardware

MacBook Air (MBA) Mid 2012