Skip to content

Instantly share code, notes, and snippets.

View pwenzel's full-sized avatar

Paul Wenzel pwenzel

View GitHub Profile
@pwenzel
pwenzel / firebase.json
Last active December 7, 2015 18:37
Possible to achieve wildcard redirects in Firebase? (Note: this does not actually work)
{
"firebase": "example-site",
"public": "public",
"redirects": [
{
"source" : "/blog/**/**",
"destination" : "http://blog.example-site.com/$1",
"type" : 302
}
]
@pwenzel
pwenzel / rbenv-fish-setup.md
Last active September 13, 2022 01:50
Installing rbenv in a fish environment

Here we use Homebrew to install rbenv:

  1. brew update; and brew install rbenv ruby-build
  2. Add ~/.rbenv/shims to your PATH
  3. Include the contents of completions/rbenv.fish in your Fish config.
  4. Run rbenv install 2.2.2 and rbenv rehash
  5. Run rbenv global 2.2.2

Now you can run gem install bundler and bundle install within your Ruby project.

@pwenzel
pwenzel / 404-error-tracking.html
Created February 20, 2015 05:19
Track 404 errors as events with Google Universal Analytics, capturing the referrer as well.
<script type="text/javascript">
// Track 404 errors with Universal Analytics
if($('body').hasClass('error404')) {
ga('send', 'event', 'error', '404', 'page: ' + document.location.pathname + document.location.search + ' ref: ' + document.referrer, {'nonInteraction': 1});
}
</script>
* Script to record and tag spotify tracks, by Lloyd Moore *)
(* Make sure you are already recording in Audio Hijack Pro with a session called 'spotifySession' *)
tell application "Spotify"
set currentTrack to (current track)
set trackName to (name of currentTrack)
tell application "Audio Hijack Pro"
set theSession to my getSession()
end tell
repeat
@pwenzel
pwenzel / trinkup
Last active August 29, 2015 14:11 — forked from ei-grad/trinkup
#!/bin/bash
#
# trinkup - TRivial INcremental bacKUP script
#
# Licensed under DWTFYWWI license, but recommended to be used before drinkup.
#
set -e
if ! which rsync >/dev/null; then
@pwenzel
pwenzel / attr_fix_cptr.php.diff
Created December 8, 2014 02:29
Fix Unescaped Title Attributes in plugin Custom Post Types Relationships (CPTR)
diff --git a/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php b/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php
index 2d82e17..853a51d 100644
--- a/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php
+++ b/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php
@@ -136,7 +136,7 @@ function cptr_category_selector() {
if (!empty($relations)) :
foreach($relations as $relation) :
$post = get_post($relation);
- echo "<div title='" . $post->post_title . "' class='thepost' id='post-".$post->ID ."'>
+ echo "<div title='" . esc_attr($post->post_title) . "' class='thepost' id='post-".$post->ID ."'>
@pwenzel
pwenzel / lamp-stack-osx-virtualhostx.md
Last active April 8, 2022 04:00
LAMP stack on OSX with Homebrew, built-in Apache, multiple PHP versions, VirtualhostX optional

This guide shows how to set up a PHP and MySQL development environment using OSX's built-in Apache, using Homebrew to install necessary components. With this strategy, you can use different versions of PHP for certain virtual hosts.

VirtualHostX is a convenient way to manage development sites, but not required.

Install PHP and MySQL with Homebrew

brew update
brew install php56
brew install php56-mcrypt
brew install mysql
@pwenzel
pwenzel / meta.php
Created May 22, 2014 21:02
Wordpress meta tags without a plugin
<?php
/**
* @link Escape post content in META Attributes, http://codex.wordpress.org/Data_Validation
* @link Complete List of HTML Meta Tags, https://gist.github.com/kevinSuttle/1997924
* @example get_template_part('meta');
*/
?>
<meta name="twitter:card" content="summary">
<!--<meta name="twitter:site" content="@YOUR_TWITTER_HANDLE">-->
@pwenzel
pwenzel / config.yaml
Created May 5, 2014 15:25
~/.config/beets/config.yaml
directory: /Volumes/BigMedia/Beets
library: /Volumes/BigMedia/Beets.blb
import:
move: no
copy: yes
write: yes
paths:
default: $albumartist - $album%aunique{}/$track $title
singleton: $albumartist - Singles/$artist - $title
comp: $album%aunique{}/$track $artist - $title
@pwenzel
pwenzel / Makefile
Created February 6, 2014 17:12
This gist accompanies https://github.com/pwenzel/fswatch-makefile. It shows how one might build a tiny build system for a website using a Makefile.
# Example Makefile for compiling CSS and Javascript in watched folder
PHONY: optimize
css:
@cat assets/css/normalize.css assets/css/app.css > public/assets/all.css
@echo Built all.css
js:
@cat assets/js/jquery.js assets/js/jquery.cookie.js assets/js/app.js > public/assets/all.js