Skip to content

Instantly share code, notes, and snippets.


Josh J. grafikchaos

View GitHub Profile
grafikchaos / Git update-index --assume-unchanged
Created Jun 15, 2011
Ignore uncommitted changes in tracked files with Git
View Git update-index --assume-unchanged
# ignore local changes to repository files or directories
git update-index --assume-unchanged path/to/file/or/directory
# -- ALIAS
# or you can alias it in your ~/.gitconfig
au = update-index --assume-unchanged
grafikchaos / php error reporting
Created Jun 30, 2011
PHP Error Reporting for local development and debugging
View php error reporting
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
grafikchaos / WordPress Contact Form 7 - defining WPCF7_PLUGIN_NAME correctly patch
Created Jul 27, 2011
Patch for correctly naming the WPCF7_PLUGIN_NAME constant using the basename() function
View WordPress Contact Form 7 - defining WPCF7_PLUGIN_NAME correctly patch
diff --git a/wp-content/plugins/contact-form-7/wp-contact-form-7.php b/wp-content/plugins/contact-form-7/wp-contact-form-7.php
index ea9427f..b8549e2 100644
--- a/wp-content/plugins/contact-form-7/wp-contact-form-7.php
+++ b/wp-content/plugins/contact-form-7/wp-contact-form-7.php
@@ -30,8 +30,9 @@ define( 'WPCF7_VERSION', '2.4.6' );
if ( ! defined( 'WPCF7_PLUGIN_BASENAME' ) )
define( 'WPCF7_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
-if ( ! defined( 'WPCF7_PLUGIN_NAME' ) )
- define( 'WPCF7_PLUGIN_NAME', trim( dirname( WPCF7_PLUGIN_BASENAME ), '/' ) );
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
grafikchaos / gist:1165560
Created Aug 23, 2011 — forked from petemcw/gist:1165317
Command-line Magic
View gist:1165560

Regular Expressions

Not only useful in programming, regular expressions can make complex tasks easy in many different scenarios. Here is a great site for testing your regex:

General Shell

Run the previous command again

grafikchaos / gist:1622609
Created Jan 16, 2012
Cucumber + Spork env.rb
View gist:1622609
require 'rubygems'
require 'spork'
Spork.prefork do
require 'simplecov'
# SimpleCov.start 'rails'
require 'cucumber/rails'
require 'factory_girl/step_definitions'
require 'email_spec'
grafikchaos / gist:2720827
Created May 17, 2012 — forked from petemcw/gist:2719758
Commands to clean a Ubuntu install for smaller Vagrant packages
View gist:2720827
# Remove items used for building, since they aren't needed anymore
sudo apt-get clean
sudo apt-get -y remove linux-headers-$(uname -r) build-essential
sudo apt-get -y autoremove
# Zero out the free space to save space in the final image:
suod dd if=/dev/zero of=/EMPTY bs=1M
sudo rm -f /EMPTY
# Removing leftover leases and persistent rules
View Rails 3 asset pipeline production
# == Precompile assets
# precompiles all CSS/JS assets in the app/assets b/c I'm lazy
# and I don't want to freaking update this every time we add/use
# sass or coffeescript files
# This strategy excludes the other default asset directories
# (lib/assets, vendor/assets) as well as any assets located
# in gems (which is okay b/c they can be called with an @import
# command or a manifest file)
grafikchaos / SVN wipeout
Created Jul 10, 2012
SVN wipe out the repo
View SVN wipeout
svn checkout --depth immediates myworking_copy
cd myworking_copy
svn rm *
svn ci -m "Deleting all"