Skip to content

Instantly share code, notes, and snippets.

View ericrasch's full-sized avatar

Eric Rasch ericrasch

View GitHub Profile
@ericrasch
ericrasch / 0_Bulletproof PHP Paths.php
Last active August 22, 2021 05:18
Different ways to find paths via PHP
<?php
/**
* Defined paths for local/production vs. staging servers
* example: http://website.com/main-folder/sub-folder/paths.php
* $full_uri: http://website.com/main-folder/sub-folder/paths.php
*/
$full_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$path = dirname($_SERVER[PHP_SELF]);
$current_path = substr( $path, strrpos($path,'/') + 1 );
@ericrasch
ericrasch / WP recommended PHP settings.md
Created April 24, 2015 17:04
Recommended PHP settings for WordPress
@ericrasch
ericrasch / WP Security README.md
Last active February 17, 2022 09:17
Hardening & Improving WordPress Security
@ericrasch
ericrasch / disable-xml-rpc.php
Created April 10, 2015 18:46
Disable XML-RPC + Pingback WordPress Plugin
<?php
/*
Plugin Name: Disable XML-RPC + Pingback
Plugin URI: http://www.philerb.com/wp-plugins/
Description: This plugin disables XML-RPC API + pingbacks in WordPress 3.5+, which is enabled by default. 2 WP plugins were combined together to cover all bases.
Version: 1.0.0
Author: Eric Rasch
Author URI: http://ericrasch.com
License: GPLv2
*/
@ericrasch
ericrasch / Gemfile
Created February 2, 2015 22:02
Generic Gemfile to add in a web project root.
source 'https://rubygems.org'
gem 'capistrano', '~> 2.15'
gem 'capistrano-ext', '~> 1.2.1'
gem 'colored', '~> 1.2'
@ericrasch
ericrasch / 00 OS X app list.md
Last active July 4, 2017 03:53
List of useful Mac apps I use daily + profiles for my home directory.

Mac OS X App List

Productivity Tools

  • Alfred Powerpack Powerpack is a set of incredibly powerful features for Alfred
  • Alfred Boosts your efficiency with hotkeys, keywords, text expansion and more
  • AppCleaner Drag-n-drop app uninstall
  • Caffeine keeps your Mac from going to sleep
  • Default Folder X Finder save location helper
  • Fantastical Menubar calendar app w/ natural language
  • GPG Suite secure communication and encrypting files

Sublime Text Preferences

My personal settings for Sublime Text (Mac). Heavily borrowed from Wes Bos: https://gist.github.com/wesbos/a3b12cfda064a906ac04

To set the key bindings below, goto Sublime Text menu -> Preferences -> Key Bindings - User, paste the settings from below and save that file.

To set the user preferences below, type ⌘, in Sublime Text to bring up the Preferences.sublime-settings file, paste the settings from below and save that file.

Installed Packages

Setup OSX 10.9 with a Clean Install

After two years of tinkering my machine is a bit all over. With Mavericks I wanted to start fresh

1. Run Software Update

Make sure everything is up to date.

Software Update

@ericrasch
ericrasch / bedrock install.md
Last active March 8, 2016 01:13
Notes on getting Bedrock (https://github.com/roots/bedrock) installed on your Mac

make a copy of php.ini (you may not need this step)

sudo cp /private/etc/php.ini.default php.ini

install composer

curl -sS https://getcomposer.org/installer | php -d detect_unicode=Off

make composer available globally

sudo mv composer.phar /usr/local/bin/composer

upgrade PHP

@ericrasch
ericrasch / Detect WordPress template file.php
Created December 3, 2014 18:31
Detect + display WordPress template file being used
<?php
/**
* Detect + display WordPress template file being used
* REF: http://www.wpmayor.com/output-name-of-wordpress-template-file-being-used/#comment-8221
*/
add_action('wp_head', 'show_template');
function show_template() {
global $template;
global $current_user;