Skip to content

Instantly share code, notes, and snippets.

View petemcw's full-sized avatar

Pete McWilliams petemcw

View GitHub Profile
require 'rubygems'
require 'sinatra'
require 'sinatra/test/unit'
require 'application'
require 'base64'
class ApplicationTest < Test::Unit::TestCase
def test_without_authentication
get '/protected'
@onyxfish
onyxfish / elections.chicagotribune.com.vcl
Created November 3, 2010 18:55
Elections Center Varnish Configuration File
backend app1 {
.host = "1.1.1.1";
.port = "80";
}
backend app2 {
.host = "2.2.2.2";
.port = "80";
}
@ticean
ticean / apache-site.conf.erb
Created December 10, 2010 04:06 — forked from yevgenko/apache-site.conf.erb
chef magento roles examples
<% if @params[:ssl] %>
<VirtualHost <%= node[:ipaddress] %>:443>
ServerName <% if node[:magento][:server][:secure_domain] %><%= node[:magento][:server][:secure_domain] %><% else %><%= @params[:server_name] %><% end %>
SSLEngine on
SSLCertificateKeyFile ssl/<%= @params[:server_name] %>.pem
SSLCertificateFile ssl/<%= @params[:server_name] %>.pem
SSLProtocol all
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
<% else %>
@petemcw
petemcw / .gitignore
Created December 16, 2010 18:24
What to ignore from Magento in Git
# Magento Connect 2 cache directories and files
downloader/pearlib/cache/
downloader/*.cfg
# Magento runtime media files
media/catalog/product/cache/
media/tmp/
media/js/
media/css/
media/.thumbs/
@petemcw
petemcw / key_generator.rb
Created April 27, 2011 15:16
Random Key Generator
class KeyGenerator
require "digest/sha1"
def self.generate(length = 12)
Digest::SHA1.hexdigest(Time.now.to_s + rand(567891234).to_s)[1..length]
end
end
@oisin
oisin / gist:952572
Created May 2, 2011 23:36
API version checking using Sinatra's before filter
require 'sinatra'
# Set the version of the API being run here
#
MAJOR_VERSION = 1
MINOR_VERSION = 0
helpers do
def version_compatible?(nums)
return MAJOR_VERSION == nums[0].to_i && MINOR_VERSION >= nums[1].to_i
@ChrisMcKee
ChrisMcKee / .gitignore
Created June 9, 2011 12:54
.gitignore file for magento projects
.htaccess
.htaccess.sample
LICENSE.html
LICENSE.txt
LICENSE_AFL.txt
RELEASE_NOTES.txt
app/*.*
app/*/*.*
app/*/*/*.*
!app/etc/modules/<Namespace>_*.xml
@grafikchaos
grafikchaos / WordPress plugin_basename patch
Created July 28, 2011 15:49
patch for WordPress plugin_basename() to correctly handle local files and symlinked files
EDIT: removed the first patch b/c it wasn't completely correct. Below is the complete patch that should be applied.
diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php
index 5bc475d..5b5e693 100644
--- a/wp-includes/plugin.php
+++ b/wp-includes/plugin.php
@@ -568,10 +568,12 @@ function plugin_basename($file) {
$mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash
@petemcw
petemcw / gist:1201928
Created September 7, 2011 22:04
MySQL user creation
GRANT USAGE ON *.* TO `user`@`localhost` IDENTIFIED BY 'password';
GRANT CREATE ROUTINE, CREATE VIEW, ALTER, SHOW VIEW, CREATE, ALTER ROUTINE, INSERT, SELECT, DELETE, UPDATE, DROP, LOCK TABLES, CREATE TEMPORARY TABLES, INDEX ON `database`.* TO `user`@`localhost` IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
@grafikchaos
grafikchaos / Upgrading Magento via diff and patch.md
Last active December 18, 2015 04:38
Creating a diff file to upgrade Magento

Before you begin

Read Aaron Hawks' blog post for the original idea for this gist.

While this process should theoretically work to upgrade the core/default files that come with Magento from any old version to the most recent version (as long as they're in the same distribution, i.e., Community to Community or Enterprise to Enterprise), you should always refer to Magento's release notes and upgrade paths for the version you're upgrading to for full details and work flow. This is the process I used to go from Magento EE 1.12.0.2 to Magento EE 1.13.0.1 directly ( skipping over 1.13.0.0 due to the instructions outlined in this Magento article and release notes ).


Upgrade Pre-Requisites