Skip to content

Instantly share code, notes, and snippets.

View derekmartinla's full-sized avatar

Derek Martin derekmartinla

View GitHub Profile

Chapter 2 - The Absolute Minimum JavaScript You Need To Know

Introduction

This chapter introduces the JavaScript language in the most efficient way possible. We'll explore the basics of JavaScript syntax, statements, variables, data structures, data types, functions, decision logic, regular expressions, and finish the tour by introducing the JavaScript Object.

Ground Rules

It's important to note that the goal of this chapter is not to make you an expert in JavaScript (or JS for short). Such a goal would be unbecoming of a language that is as rich and complex as JavaScript. Rather, the goal is to give you just enough knowledge so that you can painlessly follow the rest of the book. Below are several great books for those who would like to grow their JavaScript knowledge:

@derekmartinla
derekmartinla / autocomplete.js
Created April 20, 2017 05:19
Find keywords to include in your SEM or SEO campaigns
/**********************************************************************************************************************
* Keyword Generator Tool
* Leverages Autocomplete to find potential keyword opportunities and negative keywords,
* Version 1.2
* Created By: Derek Martin
* DerekMartinLA.com or MixedMarketingArtist.com
**********************************************************************************************************************/
'use strict';
String.prototype.capitalize = function() {
/**********************************************************************************************************************
* Keyword Generator Tool
* Leverages Autocomplete to find potential keyword opportunities and negative keywords,
* Version 1.2
* Created By: Derek Martin
* DerekMartinLA.com or MixedMarketingArtist.com
**********************************************************************************************************************/
'use strict';
String.prototype.capitalize = function() {
@derekmartinla
derekmartinla / gist:b719840542406322bb27
Last active June 2, 2017 14:20
AdWords Countdown Ads Updater Script
/***************************************************************************************
* AdWords Countdown Ad Updater -- Find stale countdown ads and replace them with
* Ads that are updated with new dates.
* Version 1.0
* Created By: Derek Martin
* DerekMartinLA.com or MixedMarketingArtist.com
****************************************************************************************/
var DESCRIPTION2_TEXT = "Sale Ends In"
function main() {
var kwIter = AdWordsApp.keywords().withCondition("Text CONTAINS '2016'").get();
while (kwIter.hasNext()) {
var keyword = kwIter.next();
// create new keyword
keyword.getAdGroup().newKeywordBuilder()
.withText(keyword.getText().replace("2016", "2017"))
.withCpc(keyword.bidding().getCpc())
@derekmartinla
derekmartinla / gist:46bbbcd2e800111fd46f
Last active November 24, 2016 16:09
Copy Existing AdWords Ads With A New Destination URL
function main() {
// change the CampaignName condition to whatever suits you
var adIter = AdWordsApp.ads().withCondition("CampaignName contains WP").withCondition("Status = ENABLED").get();
while(adIter.hasNext()) {
var ad = adIter.next();
var headline = ad.getHeadline();
var d1 = ad.getDescription1()
var d2 = ad.getDescription2();
@derekmartinla
derekmartinla / gist:c660f7d326a04e2d418e
Created April 9, 2015 16:20
Ad-Group Callout Extension Example
// Set callout extensions on the ad group level for all active ad groups based on text sent in createCallouts()
// Change campaign selection criteria as needed
function main() {
campIter = AdWordsApp.campaigns().withCondition("CampaignName contains Brand").withCondition("CampaignName does_not_contain Remarketing").get();
var callouts = createCallouts();
while (campIter.hasNext()) {
camp = campIter.next();