Skip to content

Instantly share code, notes, and snippets.

View matthewpizza's full-sized avatar
🌸
°˖✧◝(◠ᴥ◠)◜✧˖°

matthewpizza

🌸
°˖✧◝(◠ᴥ◠)◜✧˖°
View GitHub Profile
@matthewpizza
matthewpizza / wordpress.conf
Created October 13, 2016 05:59
nginx snippet to rewrite WordPress to a subdirectory install (in this case the wp dir)
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) /wp$2 last;
rewrite ^(/[^/]+)?(/.*\.php)$ /wp$2 last;
}
#!/bin/bash
cowfiles=$(cowsay -l | grep -v \/)
for cowfile in $cowfiles
do
cowsay -f $cowfile "$cowfile"
done
untrailingSlashIt(str) {
return str.replace(/\/$/, '');
}
trailingSlashIt(str) {
return untrailingSlashIt(str) + '/';
}
@matthewpizza
matthewpizza / 1-log-mousemove.js
Last active February 18, 2023 05:04
Safari’s weird mousemove — the event fires when hitting modifier keys `ctrlKey`, `shiftKey`, `altKey`, and `metaKey` https://matthewspencer.github.io/mouse-move-in-safari/
document.addEventListener('mousemove', function (event) {
console.log(event.type);
}, false);
/**
* Convert URL parameters to an object.
*
* @param {String} url
* @return {Object}
*/
function getUrlParams( url ) {
// Use the passed in string or the current URL.
url = url || document.location.href;
$.ajax({
url: 'https://gist.github.com/matthewspencer/5968c0064b1ea73c4f42.json',
dataType: 'jsonp',
timeout: 1000,
success: function (data) {
$(document.head).append('<link href="' + data.stylesheet + '" rel="stylesheet">')
$(document.body).append(data.div)
}
})
<?php
/**
* Twig filter for converting Markdown
*
* @uses Jetpack
* @uses WPCom_Markdown
*/
add_filter( 'get_twig', function ( $twig ) {
@matthewpizza
matthewpizza / vwls.sh
Last active August 29, 2015 14:19
n vwls.
#!/bin/bash
vowels=( A a E e I i O o U u Y y )
input=$1
for vowel in "${vowels[@]}"
do
input="${input//$vowel/}"
done
@matthewpizza
matthewpizza / index.js
Created March 14, 2015 15:22
Batch upload gpx files to Strava
var _ = require( 'underscore' );
var fs = require( 'fs' );
var strava = require( 'strava-v3' );
var logFile = 'data/log.txt';
var requestCount = 1;
var runsPath = '../runs/gpx/';
fs.readdir( runsPath, function ( err, files ) {
if ( err ) {
## Get rid of Google Updater
## http://superuser.com/questions/837678/how-can-i-get-rid-of-googlevoiceandvideoaccelsetup-on-mac-os-yosemite
alias fuckgoogleupdater="sudo rm -rf /private/tmp/2014*; sudo rm -rf /Library/Caches/com.google.SoftwareUpdate.0; killall Finder"