start new:
tmux
start new with session name:
tmux new -s myname
/* Produces a dump on the state of WordPress when a not found error occurs */ | |
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */ | |
ini_set( 'error_reporting', -1 ); | |
ini_set( 'display_errors', 'On' ); | |
echo '<pre>'; | |
add_action( 'parse_request', 'debug_404_rewrite_dump' ); | |
function debug_404_rewrite_dump( &$wp ) { |
if ( !class_exists( 'HijackMe' ) ) { | |
class HijackMe { | |
public function hijack_menu($objects) { | |
/** | |
* If user isn't logged in, we return the link as normal | |
*/ | |
if ( !is_user_logged_in() ) { | |
return $objects; | |
} | |
/** |
This gist contains two files for simple indexing of PDF files. | |
== requirements == | |
First you need to install Solr (which requires a Java JDK): Download a tar or zipfile at http://www.apache.org/dyn/closer.cgi/lucene/solr/ and unpack it to a directory of your choice. Go into this directory and start solr running in jetty by: | |
$ cd example | |
$ java -jar start.jar | |
Then locate your browser to http://localhost:8983/solr/ |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*" | |
} | |
parse_git_branch() { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\] $(parse_git_branch)\[\033[00m\]\$ ' |
<script type="text/javascript"> | |
(function () { | |
"use strict"; | |
// once cached, the css file is stored on the client forever unless | |
// the URL below is changed. Any change will invalidate the cache | |
var css_href = './index_files/web-fonts.css'; | |
// a simple event handler wrapper | |
function on(el, ev, callback) { | |
if (el.addEventListener) { | |
el.addEventListener(ev, callback, false); |
<?php | |
/** | |
* Usage: php adfly.php <adfly url> | |
*/ | |
// original function by mikeemoo (mikeemoo/gist:714f39befbeb188dcec9) | |
function resolveAdfly($url) { | |
if (!preg_match("@https?:\/\/adf\.ly\/[a-z0-9]+@i", $url)) { | |
return $url; | |
} |
#!/usr/bin/env php | |
<?php | |
# Save this script somewhere and set you sendmail path in php.ini like this: | |
# sendmail_path = sudo -u <your_system_username> <path_to_script>/mail.php | |
# create a filename for the emlx file | |
list($ms, $time) = explode(' ', microtime()); | |
$filename = dirname(__FILE__).'/'.date('Y-m-d h.i.s,', $time).substr($ms,2,3).'.emlx'; | |
# write the email contents to the file |
brew install git bash-completion
Configure things:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Lodash has a sweet feature called a mixin that lets you alias function names. Below here I alias names that we're used to using in SQL to (roughly) equivalent functions in lodash.
_.mixin({
select: _.map,
from: _.chain,
where: _.filter,
groupBy: _.sortByOrder,
})