Skip to content

Instantly share code, notes, and snippets.

@lukebussey
lukebussey / hubspot_pagination.html
Created May 9, 2017 15:27
HubSpot Pagination Template
{% set total_pages = contents.total_page_count %} <!-- sets variable for total pages -->
{% set more_pages = total_pages - current_page_num %} <!-- sets variable for how many more pages are past the current pages -->
{% if total_pages > 1 %}
<nav>
<ul class="pagination">
{% if current_page_num != 1 %}
<li><a href="{% if last_page_num=="1" %}{{ group.absolute_url }}{% else %}{{blog_page_link(last_page_num)}}{% endif %}"><i class="fa fa-angle-double-left"></i></a></li>
{% endif %}
{% if more_pages == 0 %}
{% if current_page_num - 4 == 1 %}<li><a href="{{ group.absolute_url }}">{{ current_page_num - 4 }}</a></li>{% endif %}

Keybase proof

I hereby claim:

  • I am lukebussey on github.
  • I am lukebussey (https://keybase.io/lukebussey) on keybase.
  • I have a public key ASC32lgaU0tUiEa65oKa907CPeioo5vvY4rOBDg_careNwo

To claim this, I am signing this object:

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

/**
* Equal height colums by applying a class of .flex-layout to a row.
*/
.row {
&.flex-layout {
@include flex-layout;
}
}
.row {

Using auto-generated UTM tagged URLs within Google AdWords along with auto-tagging for Google Analytics

The Challenge

You want to use Google AdWords' auto-tagging for a deep integration with Google Analytics, but you need to use UTM parameters with your other analytics and marketing systems, but don't want to manually tag all of your ads.

The Solution

Within AdWords, you can use ValueTrack and custom parameters along with a tracking template to automatically generate a tagged URL with all of the information you need. A tracking template which populates the query string with campaignid, adgroupid and keywork looks like this:

{lpurl}?campaignid={campaignid}&adgroupid={adgroupid}&term={keyword}

cd /Library/Preferences
sudo rm com.sophos.sav.plist

cd /Library/Application\ Support/Sophos/cloud/Installer.app/Contents/MacOS/tools/
sudo ./InstallationDeployer —force_remove
sudo dscl . -append /Groups/wheel GroupMembership $(whoami) #to add yourself to wheel
// Kill ugly querystrings
if (/^\?utm_/.test(document.location.search) && window.history.replaceState) {
window.history.replaceState({}, '', document.location.href.replace(/\?utm_.*/, ''));
}
Remove utm_* and mkt_tok parameters
(?:utm_[a-z]+|mkt_tok)=[^&]+&?
Remove trailing & or single ?
\??&?$
Input: /?utm_foo=bar&utm_bar=baz&mkt_tok=123&utm_baz=qux&bar=qux&utm_qux=foo&baz=qux&foo=bar
Output: /?bar=qux&baz=qux&foo=bar
@lukebussey
lukebussey / gist:9b53db18d3a521b3a2c9
Created November 18, 2015 00:38
Find all URLs missing a trailing slash
href="[a-z\-\/]+\/?[a-z\-]+"