View ensure-cert-macos.sh
#!/bin/bash | |
# Usage | |
# $ ./install-cert-macos.sh "/path/to/cert" | |
CERT_PATH="$1" | |
# First, grab the SHA-1 from the provided SSL cert. | |
CERT_SHA1=$(openssl x509 -in "$CERT_PATH" -sha1 -noout -fingerprint | cut -d "=" -f2 | sed "s/://g") | |
# Next, grab the SHA-1s of any standard.dev certs in the keychain. | |
# Don't return an error code if nothing is found. |
View gist:5582434
ENV_VARS="" | |
printenv | grep "^\([[:alnum:]]\|[[:punct:]]\)\+=" | sed 's/=.*$//g' | while read var; do | |
ENV_VARS+="$var=$(printenv $var)__IMPROMPTU__" | |
done |
View gallery.js
// Build a query for all attachments uploaded to a post. | |
var gallery = wp.media.query({ uploadedTo: postId }); | |
// Run the query. | |
// This returns a promise (like $.ajax) so you can do things when it completes. | |
gallery.more(); | |
// Bind your events for when the contents of the gallery changes. | |
gallery.on( 'add remove reset', function() { | |
// Something changed, update your stuff. |
View esc_attrs.php
<?php | |
function esc_attrs( $attrs ) { | |
$html = ' '; | |
$url_attrs = array( 'src', 'href', 'formaction', 'data', 'action', 'icon', 'manifest', 'poster' ); | |
foreach ( $attrs as $key => $value ) { | |
// If an attribute starts with 'on', assume it's a javascript parameter | |
if ( 'on' == substr( $key, 0, 2 ) ) |