Skip to content

Instantly share code, notes, and snippets.

@keithws
keithws / getBlogContributors.ftl
Created April 25, 2013 01:41
FreeMarker template code to create a list of users sorted by their last blog post publish date across many blogs or a single blog in Jive SBS. Tested on version 4.5.5.2 in the blog-macros.ftl file.
<#function getBlogContributors blogs>
<#local contributors = [ ]>
<#local contributorsWithDate = [ ]>
<#local blogPostObjectType = 38>
<#local resultFilter = action.getResultFilter()>
<#if blogs?has_content>
<#list blogs as blog>
<#list blog.contributors as contributor>
<#if (!(contributors?seq_contains(contributor)))>
<#-- check if user is blocked -->
@keithws
keithws / gist:7648530
Last active December 29, 2015 09:09
Clear Mac OS X Terminal with Control+L
<?xml version="1.0"?>
<root>
<item>
<name>Clear Terminal with standard control code</name>
<item>
<name>Command+L to Control+L (only in Terminal)</name>
<identifier>private.l_plus_command_to_l_plus_control</identifier>
<only>TERMINAL</only>
<autogen>__KeyToKey__ KeyCode::L, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND, KeyCode::L, ModifierFlag::CONTROL_L</autogen>
</item>
@keithws
keithws / trash.sh
Last active August 29, 2015 14:14
trash bash script
#
# trash command
# move files to the trash
#
function trash {
if [[ "$@" == "" ]]
then
echo "usage: trash file ..."
return 64
fi
@keithws
keithws / mkto.form.listener.html
Last active September 5, 2024 13:48
Marketo Form Listener for Google Tag Manager (GTM)
<script>
/**
* push events to Google Tag Manager when the Marketo Forms 2 Javascript is
* loaded and executed and when Marketo form events occur
* uses the Marketo Forms 2.0 API
* http://developers.marketo.com/documentation/websites/forms-2-0/
*
* @author Keith W. Shaw <[email protected]>
* @license MIT
*/
@keithws
keithws / gtm.captora.html
Created June 21, 2016 21:59
Captora Tracking Tag which loads jQuery when necessary
<!-- Captora -->
<script>
/**
* initialize Captora
* requires jQuery, so load jQuery if not present
*/
(function initCaptora () {
"use strict";
@keithws
keithws / state-from-zipcode.js
Created April 24, 2018 00:09
Function to return the two letter state abbreviation from a US zip code.
function stateFromZIPCode (zipcode) {
var i, item, l, state, statesByZIP;
// list of zip code ranges and the states they reside in
statesByZIP = [
[ 210, 3897, "NH" ],
[ 501, 544, "NY" ],
[ 1001, 5544, "MA" ],
[ 2801, 2940, "RI" ],
@keithws
keithws / 15-ssl-intermediate.conf
Last active November 10, 2023 13:50
Secure Dovecot SSL settings by following Mozilla's Security/Server Side TLS guidelines
##
## Dovecot SSL settings with Intermediate compatibility
## Follows Mozilla's Security/Server Side TLS guidelines
## https://wiki.mozilla.org/Security/Server_Side_TLS
##
##
## Optionial:
## Disable 3DES ciphersuites to prevent CVE-2016-2183
## by appending ":!3DES" to the ssl_cipher_list
@keithws
keithws / gtm-maxmind-geoip2-tag.html
Last active May 27, 2024 01:25
Google Tag Manager tag to load GeoIP data into the GTM data layer. Helps with GDPR.
<script src="//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js"></script>
<script>
/*
* get geographical location data by ip address
* uses the free ipify.org services
* and the paid Maxmind GeoIP2 Precision services
*/
(function (geoip2) {
@keithws
keithws / gtm-ipapi-tag.html
Created September 21, 2018 20:16
Google Tag Manager tag load GeoIP data into data layer from ipapi.co. Provides the data necessary to help with GDPR.
<script>
/*
* get geographical location data by ip address
* uses the free ipify.org service
* and the paid ipapi.co service
* and intelligent caching to minimize requests
*/
// mark the start of the script loading
@keithws
keithws / gtm-ipify-ipinfo-tag.html
Created September 21, 2018 22:15
Google Tag Manager tag to load GeoIP data into data layer. Provides country based on IP address to help with GDPR.
<script>
/*
* get geographical location data by ip address
* uses the free ipify.org service
* and the paid ipinfo.io service
* and intelligent caching to minimize requests
*/
// mark the start of the script loading