Skip to content

Instantly share code, notes, and snippets.

@ammist
ammist / find-copy-change
Last active January 1, 2016 15:18
find files newer than [filename] and copy them to [dirname]
find . -type f -newer '[filename]' -print0 | xargs -0 -I {} cp {} [dirname]
# replace strings in a file without creating a backup. the -i parameter would create a backup if you so desired
sed -i '' 's/techliminal/localhost/g' [filename]
# find all the javascript files and list them
find . -name *.js -print | xargs ls -l
# change the owner of all the javascript files
# Looks like the sudo has to be on the xargs / chown part of the operation
@ccstone
ccstone / BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
Last active May 10, 2024 15:41
BBEdit-TextWrangler Regular Expression Cheat-Sheet
————————————————————————————————————————————————————————————————————————————————————————————————————
BBEdit / BBEdit-Lite / TextWrangler Regular Expression Guide Modified: 2018/08/10 01:19
————————————————————————————————————————————————————————————————————————————————————————————————————
NOTES:
The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use.
Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete.
@scribu
scribu / gist:4150626
Created November 26, 2012 21:09
P2P Admin Dropdown
# author: sdls
# source: http://wordpress.org/support/topic/p2p-admin-view-sort-by-drop-down#post-3446538
function restrict_posts_by_relation() {
global $typenow;
$post_type = 'yourfirstposttype'; // change HERE
$related_post = 'yoursecondposttype'; // change HERE
$related_post_drop_down = 'related_'. $related_post. '_post';
if ($typenow == $post_type) {
@malarkey
malarkey / Contract Killer 3.md
Last active May 17, 2024 15:28
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@alettieri
alettieri / wp_capistrano.rb
Created August 30, 2012 17:26
WordPress Capistrano deployment file (On Webfaction)
default_run_options[:pty] = true # Must be set for the password prompt from git to work
# WebFaction user account
# This is the server user account
set :server_user, "<server_username>"
# Server Domain
set :domain, "<domain_name>"
set :user, server_user
# Repository User
@nb
nb / bootstrap-sample.php
Created August 5, 2012 19:27
Sample plugin tests config files
<?php
define( 'WP_TESTS_PATH', '<Enter the path to your unit-tests checkout>' );
$GLOBALS['wp_tests_options'] = array(
'active_plugins' => array( '<plugindir/<plugin>.php' ),
);
require rtrim( WP_TESTS_PATH, DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR . 'bootstrap.php';
@nacin
nacin / func.sh
Created July 10, 2012 16:44
Nacin's WP Test Wrapper
function wptest() {
TESTROOT=/Users/nacin/Sites/tests
ARGS="--colors $@"
FORCE=0
DEBUG=0
REPLACE=$(echo $ARGS | sed -e 's/ -f\>//')
if [ "$ARGS" != "$REPLACE" ]; then
FORCE=1
ARGS=$REPLACE
@alettieri
alettieri / business.php
Created July 6, 2012 17:49
Sortable WordPress Columns
//
// Make these columns sortable
//
function business_sortable_columns() {
return array(
'images' => 'images',
'title' => 'title',
"parking" => "parking"
);
}
@alettieri
alettieri / business.php
Created July 6, 2012 17:36
WordPress Geocode
function business_save_post($post_id, $post){
// verify if this is an auto save routine.
// If it is our form has not been submitted, so we dont want to do anything
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
// verify this came from the our screen and with proper authorization,
// because save_post can be triggered at other times
if ( isset( $_POST[ 'business_noncename' ] ) && !wp_verify_nonce( $_POST['business_noncename'], plugin_basename( __FILE__ ) ) )
@rmccue
rmccue / plugin-file.php
Created January 17, 2012 12:27 — forked from kovshenin/plugin-file.php
Improved class concept
<?php
/*****
All new versions will be posted at
https://github.com/rmccue/Rotor_WPPlugin
Please use that repository instead of this Gist.
******/