Skip to content

Instantly share code, notes, and snippets.

Avatar

Pete McWilliams petemcw

View GitHub Profile
View testing_http_auth_in_sinatra.rb
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 Nov 3, 2010
Elections Center Varnish Configuration File
View elections.chicagotribune.com.vcl
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 Dec 10, 2010 — forked from yevgenko/apache-site.conf.erb
chef magento roles examples
View apache-site.conf.erb
<% 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 Dec 16, 2010
What to ignore from Magento in Git
View .gitignore
# 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 Apr 27, 2011
Random Key Generator
View key_generator.rb
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
API version checking using Sinatra's before filter
View gist:952572
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 Jun 9, 2011
.gitignore file for magento projects
View .gitignore
.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 Jul 28, 2011
patch for WordPress plugin_basename() to correctly handle local files and symlinked files
View WordPress plugin_basename patch
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 Sep 7, 2011
MySQL user creation
View gist:1201928
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 Dec 18, 2015
Creating a diff file to upgrade Magento
View Upgrading Magento via diff and patch.md

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