Skip to content

Instantly share code, notes, and snippets.

View UndefinedOffset's full-sized avatar

Ed Chipman UndefinedOffset

View GitHub Profile
@UndefinedOffset
UndefinedOffset / nr-deploy-post-merge-hook.sh
Last active July 9, 2021 10:19
A simple git deploy hook for notifying New Relic of deployments, it assumes that the base folder name of the repository is the application name. To set git to use this script you simply add this file into your .git/hooks folder as "post-merge".
#!/bin/bash
#New Relic API Key see https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/api-key#creating
NR_API_KEY="INSERT_API_KEY_HERE"
#Find New Relic App Name, if your top level folder is not the name of your application change the below two lines to simply NR_APP_NAME="MY_APP_NAME".
NR_APP_NAME=$(git rev-parse --show-toplevel)
NR_APP_NAME=$(basename "$NR_APP_NAME")
#Get the current git branch
//Ref: https://www.datatables.net/release-datatables/extensions/TableTools/examples/select_multi.html
var tableRows=[];
var tableHeadings=[];
$('#example thead th').each(function() {
tableHeadings.push($(this).text());
});
tableRows.push(tableHeadings.join(','));
@UndefinedOffset
UndefinedOffset / TaskListParsedown.php
Last active June 5, 2020 02:34
Override's some of Parsedown's features to add support for github style task lists. You must build your own serverside & client side components for updating the markdown. The value of the checkbox is it's index of the checkbox based on all of the checkboxes found in the markdown.
<?php
/**
* Override's some of Parsedown's features to add support for github style task lists.
* You must build your own serverside & client side components for updating the markdown.
* The value of the checkbox is it's index of the checkbox based on all of the checkboxes found in the markdown.
* @see https://github.com/erusev/parsedown
*/
class TaskListParsedown extends Parsedown {
protected $taskListIndex=0;