Skip to content

Instantly share code, notes, and snippets.

@blueprintmrk
blueprintmrk / PagerDutyWebhookToEmail.php
Last active April 18, 2016 02:49 — forked from eurica/PagerDutyWebhookToEmail.php
Simple example of using PagerDuty webhooks and PHP to forward all incident state changes to an email address.
Sample PHP code to accept PagerDuty webhooks and send out notifications by email on state changes.
For more information, see http://developer.pagerduty.com/documentation/rest/webhooks
This example threads emails based on "$status: $description on $service" so each update to each incident would start a new thread.
This code is unsupported by PagerDuty.
<?php
$emailAddress = "[email protected]";
@blueprintmrk
blueprintmrk / criticalcss-bookmarklet-devtool-snippet.js
Created February 7, 2016 18:25 — forked from PaulKinlan/criticalcss-bookmarklet-devtool-snippet.js
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@blueprintmrk
blueprintmrk / nginx.conf
Created April 27, 2016 00:07 — forked from markjaquith/nginx.conf
My WordPress Nginx setup
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
}
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
}
# SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
content
ENV='ENV'
SITE='SITEID'
read -sp "Your Pantheon Password: " PASSWORD
if [[ -z "$PASSWORD" ]]; then
echo "Woops, need password"
exit
fi
while [ 1 ]
@blueprintmrk
blueprintmrk / gw-gravity-forms-map-fields-to-field.php
Created May 2, 2016 17:08 — forked from spivurno/gw-gravity-forms-map-fields-to-field.php
Gravity Wiz // Gravity Forms // Map Submitted Field Values to Another Field
<?php
/**
* Gravity Wiz // Gravity Forms // Map Submitted Field Values to Another Field
*
* Preview your Gravity forms on the frontend of your website. Adds a "Live Preview" link to the Gravity Forms toolbar.
*
* Usage
*
* 1 - Enable "Allow field to be populated dynamically" option on field which should be populated.
* 2 - In the "Parameter Name" input, enter the merge tag (or merge tags) of the field whose value whould be populated into this field.
<script>
(function(){
var data = {
"@context": "http://schema.org",
"@type": "BlogPosting",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": {{Page URL}}
},
"headline": {{SCHEMA - Article Headline}},
@blueprintmrk
blueprintmrk / .htaccess
Created January 8, 2017 22:56 — forked from mudge/.htaccess
Remove file extensions in URLs with mod_rewrite but preserve 404 errors.
# The following will allow you to use URLs such as the following:
#
# example.com/anything
# example.com/anything/
#
# Which will actually serve files such as the following:
#
# example.com/anything.html
# example.com/anything.php
#
@blueprintmrk
blueprintmrk / 0_reuse_code.js
Created February 13, 2017 17:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@blueprintmrk
blueprintmrk / critcss.snippet.js
Last active December 27, 2017 22:31 — forked from pibby/critcss.snippet.js
Critical CSS Finder w/media query support for those of us who write mobile-first CSS; will output to console; configurable viewport height on line 12.
/* Critical CSS Finder w/media query support and output to console
by Katie Harron - https://github.com/pibby - https://pibby.com
forked from james-Ballyhoo (https://gist.github.com/james-Ballyhoo/04761ed2a5778c505527) who forked from PaulKinlan (https://gist.github.com/PaulKinlan/6284142)
I don't know why this isn't keeping my 2 space indents :(
*/
(function() {
function findCriticalCSS(w, d) {
// Pseudo classes formatting
var formatPseudo = /([^\s,\:\(])\:\:?(?!not)[a-zA-Z\-]{1,}(?:\(.*?\))?/g;