Skip to content

Instantly share code, notes, and snippets.

View jeremyfelt's full-sized avatar
🍕
Look at that pizza emoji!

Jeremy Felt jeremyfelt

🍕
Look at that pizza emoji!
View GitHub Profile
@jeremyfelt
jeremyfelt / gist:4459600
Last active December 10, 2015 16:18
Whistle while you work...
$('.pds-input-label').on('click', function(){
window["PD_prevote" + jQuery('.PDS_Poll')
.attr('id')
.substring(13)](this);
});
## ls -l on vagrant wp-content/plugins/
drwxr-xr-x 1 www-data vagrant 238 Jan 4 05:49 debug-bar
drwxr-xr-x 1 www-data vagrant 238 Jan 4 05:49 debug-bar-cron
drwxr-xr-x 1 www-data vagrant 340 Jan 7 2013 debug-bar-extender
drwxr-xr-x 1 www-data vagrant 170 Jan 4 05:49 debug-bar-hook-explorer
drwxr-xr-x 1 www-data vagrant 442 Jan 4 05:49 developer
## ls -l on local wp-content/plugins/
drwxr-xr-x 7 jeremyfelt staff 238 Jan 3 21:49 debug-bar
drwxr-xr-x 7 jeremyfelt staff 238 Jan 3 21:49 debug-bar-cron
repo_to_repo() {
local DEVENV="/Users/jeremyfelt/Development/wordpress-main/wp-content/themes/vip/"
echo $DEVENV
rsync -rv --delete --exclude='.idea' --exclude='.svn' $DEVENV$1/* $DEVENV$2
cd $DEVENV$2
svn status | grep '^!' | awk '{print $2}' | xargs svn rm
svn status | grep '^?' | awk '{print $2}' | xargs svn add
}
@jeremyfelt
jeremyfelt / gist:4508547
Created January 11, 2013 06:59
JS logging script
/**
* Stolen from http://thanpol.as/javascript/you-dont-need-dom-ready/ - Good read!
* /
// get the current time difference between page
// load and when this func was invoked
function getTimeDiff() {
return new Date().getTime() - performance.timing.navigationStart;
}
var $log, jqLoaded = false;
import tweepy
from BeautifulSoup import BeautifulSoup as parser
import urllib
import sys
consumer_key=''
consumer_secret=''
access_token=''
access_token_secret=''
@jeremyfelt
jeremyfelt / status-update.php
Created January 23, 2013 22:37
Post to P2 from command line with a very basic XMLRPC request
<?php
/**
* Post to a P2 from the command line (OSX at least)
*
* Easier with something like this in your .bash_profile:
*
* status_update() {
* php ~/Development/tools/status-update.php "$1" "$2"
* }
<?php
$xml_data = file_get_contents( 'test.xml' );
$xml_parsed = simplexml_load_string( $xml_data, 'SimpleXMLElement', LIBXML_NOCDATA );
foreach ( $xml_parsed->channel->item as $item ) {
echo $item->children('content', true)->encoded;
}
@jeremyfelt
jeremyfelt / edit-edit-link.php
Created February 15, 2013 20:16
Filter the Recent Comments (side effect of Recent Drafts) links on the admin dashboard to go to the front end instead of the edit screen.
-- Project Config File:
1) import_db: auto | automatically import database and symlink on vagrant up or project import command if DB does not yet exist
2) import_db: never | Never import database
3) import_db: always | Always import DB, even if it removes and then overwrites existing symlinked DB
# Primary vagrant directory includes the most common setup for your
# projects via Vagrantfile and provisioning. Any time a project is
# added to the "project" directory, it can be imported in with a
# project-import command in vagrant ssh. The Vagrantfile and provisioning
# in each project directory is ignored (see below scenario)
1. Site files in www/mynewsite
2. SQL dump (if needed) in database/backups/database_name.sql
3. CREATE DATABASE and GRANT PRIVILEGES statements for new DB name in database/init-custom.sql
4. nginx config at /config/nginx-config/sites/my.site.name.conf
5. nginx config should have a unique server name and point to the www/mynewsite directory
6. vagrant reload
7. edit hosts file to point 192.168.50.4 to my.site.name