Skip to content

Instantly share code, notes, and snippets.

Avatar

Courtney Grimes cougrimes

View GitHub Profile
@cougrimes
cougrimes / monospace.gs
Created Dec 11, 2020
A Google Apps script for creating custom monospace styles in documents. Pair with a macro editor to use as a keyboard shortcut!
View monospace.gs
/* Welcome to monospace.gs, a script that handles standardizing formatting for items
needing monospace formatting in documents. Note that if you are wanting to share
large code blocks, you likely should install the following add-on:
https://workspace.google.com/marketplace/app/code_blocks/100740430168
This plugin is meant more for psuedocode and inline markup of code elements in
documentation. Use https://www.autocontrol.app/ to assign a keyboard shortcut for
the script's behavior. Enjoy! */
// Add new menu item
@cougrimes
cougrimes / lib-singlepageapp.js
Last active Sep 10, 2020
I got frustrated by the lack of more intuitive single-page app tracking in Tealium and wrote a hacky workaround. Use at your own discretion.
View lib-singlepageapp.js
/* Welcome to lib-singlepageapp.js! This script is meant to handle using single-page
applications (SPAs) for Tealium when you do not have direct access to Angular, Vue,
React, etc. for making modifications. This allows us to get around limitations of
utag.view(). The trigger in this case is a global event listener that evaluates
any time there is a click, HTML5 history API replacement, load event, or DOMContentLoaded
event. If a new URL is populated via the history API, we'll treat that as a "pageview".
Note in this case that I have defined a UDO variable of page. This variable is then mapped
to anything requiring a page URL. For example, in GA I have this variable mapped to
config.page_location so it acts like a native page URL view.*/
@cougrimes
cougrimes / csv-splitter.sh
Last active Sep 5, 2018
CSV Splitter. Use as ./csv-splitter.sh [your_csv_filename] [number_of_lines_to_split_into]
View csv-splitter.sh
#!/bin/bash
FILENAME=$1
FILESIZE=$(stat -c%s "$FILENAME")
FILELINES=$(wc -l < $FILENAME)
SPLITRATIO=$(($FILESIZE / 9500000))
[ -z "$2" ] && LINES=$(($FILELINES / $SPLITRATIO)) || LINES=$2
TRIM="${FILENAME:0:${#FILENAME}-4}"
HDR=$(head -1 $FILENAME)
split -l $LINES $FILENAME xyz
@cougrimes
cougrimes / marketo-form-confirmation.html
Created Oct 20, 2017
Show message on same page after successful form submission.
View marketo-form-confirmation.html
<div class="container">
<script src="//app-abc.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_27"></form>
<script>MktoForms2.loadForm("//app-abc.marketo.com", "123-ABC-456", 1);</script>
<div id="confirmation" aria-hidden="true" style="display:none;">
<p>This is a sample thank you message. Thanks for viewing.</p>
</div>
</div>
<script>
MktoForms2.whenReady(function (form){
@cougrimes
cougrimes / marketo-form-ga.js
Created Oct 20, 2017
Send Google Analytics event on Marketo form submission
View marketo-form-ga.js
MktoForms2.whenReady(function(form) {
form.onSuccess(function(vals, page) {
ga('send', 'event', {
eventCategory: 'Marketo Form',
eventAction: 'Form Submission',
eventLabel: formName,
hitCallback: function() {
document.location.href = page;
};
});
@cougrimes
cougrimes / velocity-marketo-npp.xml
Created Jul 3, 2017
Velocity syntax highlighting for Notepad++, Marketo-specific
View velocity-marketo-npp.xml
<NotepadPlus>
<UserLang name="Velocity" ext="vm" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="yes" Keywords3="yes" Keywords4="yes" Keywords5="yes" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">03#* 04*# 00## 01 02</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
View mailcheck-marketo.js
MktoForms2.whenReady(function (form){
var domains = ["aol.com", "att.net", "comcast.net", "facebook.com", "gmail.com", "gmx.com", "googlemail.com","google.com", "hotmail.com", "hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com","live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk", "email.com", "games.com", "gmx.net", "hush.com", "hushmail.com", "icloud.com", "inbox.com","lavabit.com", "love.com" , "outlook.com", "pobox.com", "rocketmail.com" ,"safe-mail.net", "wow.com", "ygm.com", "ymail.com" , "zoho.com", "fastmail.fm","yandex.com","iname.com","bellsouth.net", "charter.net", "cox.net", "earthlink.net", "juno.com","btinternet.com", "virginmedia.com", "blueyonder.co.uk", "freeserve.co.uk", "live.co.uk","ntlworld.com", "o2.co.uk", "orange.net", "sky.com", "talktalk.co.uk", "tiscali.co.uk","virgin.net", "wanadoo.co.uk", "bt.com", "sina.com", "qq.com", "naver.com", "hanmail.net", "daum.net", "nate.com", "yahoo.co.jp", "yahoo.co.kr", "yahoo.co.id", "yahoo.co.in", "yahoo.com.sg", "yahoo.c
@cougrimes
cougrimes / grid-only.css
Created May 2, 2017
Bootstrap 4, Grid Only, Compiled
View grid-only.css
.container {
margin-left: auto;
margin-right: auto;
padding-left: 15px;
padding-right: 15px;
}
.container::after {
content: "";
display: table;
clear: both;
View cta_links.js
View exampleOutput.json
{
"kind": "analytics#gaData",
"id": "https:\/\/www.googleapis.com\/analytics\/v3\/data\/ga?ids=ga:YYYYYYYYY&dimensions=ga:dimension1&metrics=ga:avgTimeOnPage&start-date=30daysAgo&end-date=yesterday",
"query": {
"start-date": "30daysAgo",
"end-date": "yesterday",
"ids": "ga:YYYYYYYYY",
"dimensions": "ga:dimension1",
"metrics": [
"ga:avgTimeOnPage"