Skip to content

Instantly share code, notes, and snippets.

View scottnath's full-sized avatar

Scott Nath scottnath

View GitHub Profile
@scottnath
scottnath / gist:3750842
Last active May 17, 2016 17:41
find text inside a file on command line
find . -name '*' -exec grep -li 'text_to_search_for' {} \;
// ignore directories (won't show ".. is a directory")
find . -name '*' -exec grep -sli 'TEXT' {} \;
// exclude directories (like `node_modules`)
find . -name '*' -not -path './node_modules/*' -exec grep -sli 'TEXT' {} \;
@scottnath
scottnath / gist:3707733
Created September 12, 2012 16:07
change chmod on a file or folder on command line/terminal
FILES to 664:
$ find /place/you/need/to/be/* -type f -exec chmod 664 {} \;
FOLDERS to 775:
$ find /place/you/need/to/be/* -type d -exec chmod 775 {} \;
@scottnath
scottnath / gist:3707693
Created September 12, 2012 16:03
Create symlink on the command line/terminal
ln -s /folder/or/file/we/are/linking/to/ folder_or_file
@scottnath
scottnath / gist:2148283
Created March 21, 2012 15:16
simple acf field group
<?
if(function_exists("register_field_group"))
{
register_field_group(array (
'title' => 'Category bug test',
'fields' =>
array (
0 =>
array (
@scottnath
scottnath / 0-env-url-override.php
Created February 22, 2012 15:51 — forked from mjangda/0-env-url-override.php
How to use WordPress across environments without needing to mess with URLs in the database.
<?php
// This is the meat of the plugin and should go in mu-plugins/0-env-url-override.php
// Only load these filters if we're not in the production environment
if ( defined( 'ENV_NOT_PRODUCTION' ) && ENV_NOT_PRODUCTION ) {
// This always needs to be filtered
add_filter( 'site_url', 'env_filter_site_url', 0 );
// We don't filter home_url in the admin so that we get production URLs for posts.
// This does break certain links like "Preview/View Post", however.
@scottnath
scottnath / nbcu_plugins_url
Created January 4, 2012 17:59
function nbcu_plugins_url
function nbcu_plugins_url( $url = '', $path = '', $plugin = '' ) {
$nbcu_url = '/nbcu-plugins/';
$plugin_base_name = basename( dirname( $plugin ));
$plugin_dir_path = rtrim(str_replace( basename( dirname( $plugin ) ), '', dirname( $plugin ) ), '/');
if($plugin_dir_path != WP_PLUGIN_DIR){
$url = WP_PLUGIN_URL.$nbcu_url.$plugin_base_name;
}