This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/ | |
// JavaScript regex trick: Parse a query string into an object | |
var queryString = {}; | |
anchor.href.replace( | |
new RegExp("([^?=&]+)(=([^&]*))?", "g"), | |
function($0, $1, $2, $3) { queryString[$1] = $3; } | |
); | |
// Usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nginx Embedded Perl module for adding a Content-MD5 HTTP header | |
# | |
# This perl module, will output an MD5 of a requested file using the | |
# Content-MD5 HTTP header, by pulling the hex hash from a file of the | |
# same name with .md5 appended to the end, if it exists. | |
# | |
# Author: Matt Martz <[email protected]> | |
# Link: https://gist.github.com/1870822#file_content_md5_req_dot_md5.pm | |
# License: http://www.nginx.org/LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "[post-rewrite hook: $1]" | |
# quick script to call "git submodule update" automatically if the | |
# .gitmodules file is changed | |
changedfiles=( `git diff-tree --no-commit-id --name-only HEAD@{1} HEAD` ) | |
if [[ "${changedfiles[*]}" =~ ".gitmodules" ]]; then | |
echo "initializing & updating submodule(s)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
access_log /usr/local/var/log/nginx/access.log; | |
error_log /usr/local/var/log/nginx/error.log; | |
include mime.types; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Return an ID of an attachment by searching the database with the file URL. | |
* | |
* First checks to see if the $url is pointing to a file that exists in | |
* the wp-content directory. If so, then we search the database for a | |
* partial match consisting of the remaining path AFTER the wp-content | |
* directory. Finally, if a match is found the attachment ID will be | |
* returned. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------------------------------------------------------------------------- | |
# | |
# Mine: | |
alias composer="/usr/local/bin/composer.phar" | |
alias dump="composer dump-autoload" | |
alias www="cd /Applications/XAMPP/xamppfiles/htdocs/" | |
alias pong="ping 8.8.8.8" | |
alias bitpush="git push bitbucket master" |