Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View petemcw's full-sized avatar

Pete McWilliams petemcw

View GitHub Profile
@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
@kopischke
kopischke / markdown2evernote.rb
Created June 5, 2011 16:57
OS X service scripts
#!/usr/bin/env ruby -wKU
# Adapted from Brett Terpstra’s original “Markdown to Evernote” service (http://brettterpstra.com/a-better-os-x-system-service-for-evernote-notes-with-multimarkdown/)
# Martin Kopischke 2011 – License: Creative Commons Attribution Share-Alike (CC BY-SA) 3.0 Unported (http://creativecommons.org/licenses/by-sa/3.0/)
# Changes: – create only one Evernote note per (Multi)Markdown input passed (instead of one per line)
# – do not choke on shell escape characters (use Tempfile instead of shell pipe for osascript)
# – default to MultiMarkdown 3 executable (instead of MMD 2 Perl script)
# – make smart typography processing optional (set SMARTY to 'false' to bypass processing;
# note smart typography cannot be disabled in MMD 3.0 and 3.0.1
# – handle both smart typography processing scripts (ie. SmartyPants.pl)
@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
@davidalexander
davidalexander / gist:1086455
Last active September 7, 2023 07:42
Magento Snippets

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@petemcw
petemcw / magento_sql_snippets.md
Created July 21, 2011 19:41
Magento SQL Snippets

Magento SQL Snippets

Clear Temporary Data Tables

TRUNCATE `log_customer`;
TRUNCATE `log_quote`;
TRUNCATE `log_summary`;
TRUNCATE `log_url`;
TRUNCATE `log_url_info`;
@jpantuso
jpantuso / osx_lion_rail_setup.md
Created July 27, 2011 19:51
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
@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
@napcs
napcs / .tmux.clipboard
Created August 15, 2011 19:28
My tmux config
# configuration for osx clipboard support
set-option -g default-command "reattach-to-user-namespace -l sh"
@petemcw
petemcw / gist:1169053
Created August 24, 2011 20:06 — forked from davidalexander/gist:1086455
Magento Snippets

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@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;