Skip to content

Instantly share code, notes, and snippets.

View simeonpashley's full-sized avatar
🎯
Working for Farnell.com

Simeon Pashley simeonpashley

🎯
Working for Farnell.com
View GitHub Profile
@simeonpashley
simeonpashley / Untitled-2
Created July 16, 2018 11:03
Sticky header
//sticky
$(function() {
// Hide Header on on scroll down
var didScroll = false;
var lastScrollTop = 0;
var delta = 5;
var navbarHeight = $('.c-header').outerHeight() + 30;
if ($(window).scrollTop() == 0) {
$('.c-header').addClass('js-at-top');
ITxhcmNoPgpkZWJpYW4tYmluYXJ5ICAgMTU5MTA2ODg5NyAgMCAgICAgMCAgICAgMTAwNjQ0ICA0ICAgICAgICAgYAoyLjAKY29udHJvbC50YXIueHogIDE1OTEwNjg4OTcgIDAgICAgIDAgICAgIDEwMDY0NCAgNDM0OCAgICAgIGAK/Td6WFoAAATm1rRGBMC6IYCgASEBFgAAAAAAALXu2gvgT/8Qsl0AFwu8HH0BlcAdSj55FcLMJqNZQdPYEMXkIzXBJC65Mtp6ankPUE4aYPdeOkI+ANoWxTPZcV/NFid8KUtxGHkwGejXcUntc6u/397P9vljEHZM8M4K8g7P2p0viMI+ccCYylp/62FCFTid+aKluYZvzQ//6pZRyabrcgA+rHaKW7vTIkXacoQhN24sLmkHkW3UMyi9k0BKQe9nszDQqc2rpnd4rGCuC1U8Awewau0ilkuhAjJrjYWv2lRBpd96thKFKdXrpQkt0iZhnR9akYnq/CVVSLpViHbyUMB0gL1NhxQuOOTrBWeh2vL1ZTXNbvgaLSzkgMGe4u61Pz5IUZUJTbqi38X77SBM0UIqBT29XB+S9UCzaDc4Ua7zLs0QS8E0ITXZw+0D+MSDRF8pIaobBjJyAACvwQhpArVPSsan5sbbMHLUwSyP9B0D3FNARQa3TpNUVWO5DrvbDGCyclIDkv5uzfYTmQJoYB7aBE8YE8U4wS44tBru6+aspglVD2Ulc5ihh6Gv/WfMblCEuoQu2WHLjGFqFr0xakv8mHmNzakRWiMeiHrTqVMTWpZaEA0o+KghM/9UK33RQSC6mGKPLzrFI67GGxMUHvEDQJZP+ZxQPc9qPy6jl1vGYyQwou9erpSx9/jN5WK+Yjpnslj/T292C6JKn/77u4QhDU86b50kQR48B+lPRQ8DVmzP6PbNTGEamrdRE+sNAwGwtdfN3ayG+yjJZ5mzFzvLKA7o2g0zYGrR1hB8kaJPqmQBJiv79faQWwuxAXC3JqvobzDT+flVe0WE
@simeonpashley
simeonpashley / Check If Account Is Offline.js
Created July 17, 2018 18:58
AW Check If Account Is Offline
/*
OPTMYZR.COM - PPC AUTOMATION AND TOOLS
---------------------------------------
Script by Optmyzr Inc. 2016-2017
This script checks whether an AdWords account has gone offline, possibly due to a declined credit card.
It does this by checking if a selected metric (like impressions) has accrued some value over a chosen
number of hours. The user can choose the number of hours to look back so that they can account for
expected periods of non-activity (e.g. due to dayparting)
@simeonpashley
simeonpashley / Advanced AdWords Budgets.js
Created July 17, 2018 18:57
Advanced AdWords Budgets
DEBUG = 0;
function main() {
Logger.log("");
//var SETTINGS = new Object();
currentSetting = new Object();
currentSetting.scope = "Account";
@simeonpashley
simeonpashley / AW Monthly Budgets With Day Of Week Allocation.js
Created July 17, 2018 18:55
Monthly Budgets With Day Of Week Allocation
// Copyright 2015, Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@simeonpashley
simeonpashley / AW Script to count ads and keywords in ad groups.js
Created July 17, 2018 18:51
AW Script to count ads and keywords in ad groups.js
function main() {
var adGroupIterator = AdWordsApp.adGroups().withCondition('Status = ENABLED').withCondition('CampaignStatus = ENABLED').get();
while (adGroupIterator.hasNext()) {
var adGroup = adGroupIterator.next();
// Keyword Checks
var keywordIterator = adGroup.keywords().withCondition('Status = ENABLED').get();
var numKeywords = keywordIterator.totalNumEntities();
if(numKeywords >= 15) {
var campaignName = adGroup.getCampaign().getName();
var adGroupName = adGroup.getName();
@simeonpashley
simeonpashley / adwordsShoppingBidderCPA.js
Last active July 17, 2018 18:50
AdWords Shopping Bidder - CPA Target £20
function main() {
var targetCPA = 20;
var productGroupSelector = AdWordsApp
.productGroups()
.withCondition("Impressions > 100")
.forDateRange("LAST_MONTH")
.orderBy("Clicks DESC");
var productGroupIterator = productGroupSelector.get();
.fx *, .fx::after, .fx::before {
box-sizing: border-box;
}
.fx .dot {
align-items: center;
background-color: rgba(43, 178, 76, 0.38);
border: 1px solid rgba(43, 178, 76, 0.54);
border-radius: 1rem;
box-shadow: 0 1px 10px 0 rgba(0, 0, 0, 0.15);
@simeonpashley
simeonpashley / Untitled-2
Created July 16, 2018 11:06
create uuid
createUuid: function() {
// Copy & paste form http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript/2117523#2117523
// This is a cryptograhically not secure implementation, but is good enough for the given use case
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
.replace(/[xy]/g, function(c) {
var r = Math.random() * 16|0, v = c == 'x' ? r : (r&0x3|0x8)
return v.toString(16)
})
},
@simeonpashley
simeonpashley / Untitled-2
Created July 16, 2018 11:02
validateEmail
function validateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}