Skip to content

Instantly share code, notes, and snippets.

View MikeNGarrett's full-sized avatar
🤘
Rocking this project.

Mike Garrett MikeNGarrett

🤘
Rocking this project.
View GitHub Profile
─────────▄──────────────▄────
────────▌▒█───────────▄▀▒▌───
────────▌▒▒▀▄───────▄▀▒▒▒▐───
───────▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐───
─────▄▄▀▒▒▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐───
───▄▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀██▀▒▌───
──▐▒▒▒▄▄▄▒▒▒▒▒▒▒▒▒▒▒▒▒▀▄▒▒▌──
──▌▒▒▐▄█▀▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐──
─▐▒▒▒▒▒▒▒▒▒▒▒▌██▀▒▒▒▒▒▒▒▒▀▄▌─
─▌▒▀▄██▄▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▌─
@MikeNGarrett
MikeNGarrett / gist:40059cae93fa8311ce5c39caaefb8594
Created May 3, 2016 14:46
Acquia DevDesktop Drush Location
$ # If you're using Drush with MAMP and DevDesktop, you'll have to either change your bash profile or (my preference) specify the path to the correct instance of Drush.
$ # This solves the "Command pm-update needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command" issue.
$ /Applications/DevDesktop/drush/drush
@MikeNGarrett
MikeNGarrett / 404s.sh
Created November 18, 2015 22:50
Go and get the most frequent 404s
grep "HTTP/1.1\" 404" access.log | awk '{print $7 } ' | sort | uniq -c | sort -n
@MikeNGarrett
MikeNGarrett / wp-config.php
Last active February 12, 2025 14:27
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@MikeNGarrett
MikeNGarrett / siege
Last active December 3, 2024 17:20
Siege with JSON POST data
# Changed to use content-type flag instead of header: -H 'Content-Type: application/json'
siege -c50 -t60S --content-type "application/json" 'http://domain.com/path/to/json.php POST {"ids": ["1","2","3"]}'
@MikeNGarrett
MikeNGarrett / import-wp-users-by-role
Last active August 29, 2015 14:23
Add a list of WordPress users from a CSV
# CSV format: username, email, password
export IFS=","; cat /path/to/test.csv | while read a b c; do wp user create $a $b --user_pass=$c --role=administrator; done
@MikeNGarrett
MikeNGarrett / output-all-wp-image-styles
Last active August 29, 2015 14:11
WordPress print all image sizes
add_action( 'shutdown', function() { global $_wp_additional_image_sizes; var_dump($_wp_additional_image_sizes); die; });
@MikeNGarrett
MikeNGarrett / keybase.md
Created October 1, 2014 15:36
keybase.io verification

Keybase proof

I hereby claim:

  • I am MikeNGarrett on github.
  • I am mikengarrett (https://keybase.io/mikengarrett) on keybase.
  • I have a public key whose fingerprint is EC65 0153 F732 6C65 E9AD 7362 A8AC 3E70 563A 657D

To claim this, I am signing this object:

@MikeNGarrett
MikeNGarrett / chmod-correct-files
Last active November 21, 2016 08:49
Change file permissions to 664, directory permissions to 775
// Run this from the command line.
// h/t: http://superuser.com/questions/91935/how-to-chmod-755-all-directories-but-no-file-recursively#answer-91966
// add read/execute to world, remove write
chmod -R u+rwX,g+rwX,o+rX-w path/
// remove read/write/execute from world
chmod -R u+rwX,g+rwX,o-rwX path/
@MikeNGarrett
MikeNGarrett / script.js
Created August 24, 2014 01:36
Script for organizing abetterqueue.com
var out = ''; jQuery('.rating').each(function(a){ out += "<b data-rating="+jQuery(this).text().trim().replace('%', '')+">"+jQuery(this).text().trim().replace('%', '')+","+jQuery(this).children().attr('href')+"</b><br>" }); jQuery('body').html(out);