This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
"use strict"; | |
// as user scrolls down / up, fade and move banner text | |
$(document).on("ready", function () { | |
var reFadeAndTranslate, deReFadeAndTranslate, \$bannerText; | |
\$bannerText = $("div.banner-text"); | |
reFadeAndTranslate = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://developers.marketo.com/javascript-api/forms/ | |
/* Using Forms 2.0 from Landing Pages | |
While all of the forms examples use embedded forms, the same APIs are available on Marketo Landing Pages as well. | |
Usually, you’ll want to add a script that gets some reference to the form object. To do this, first add your form to the landing page, then add a new HTML block to your landing page. Then you can add a script block to the page as follows */ | |
MktoForms2.whenReady(function (form) { | |
var selectedPackage, Marketing_Asset_Id_Current__c, last_mkt_asset, Company_Size_Range__c_account, formTrialPackageType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var translate = require('google-translate-api'); | |
var fs = require('fs'); | |
var async = require('async'); | |
// array of filenames | |
// each file contains a JSON object | |
var filenames = [ | |
"0001-school-life-buying-textbooks.js", | |
"0002-school-life-class-registration.js", | |
"0003-school-life-too-many-full-classes.js" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("body").append("<div class='a'></div>"); | |
$(document).on("click", "div.a", function (event) { | |
// do something when the div is clicked | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector('div.a').addEventListener('click', function(event) { | |
if (event.target.className === 'a') { | |
// do something | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get the div | |
var div = document.querySelector('div.a'); | |
// detach the div | |
div = div.parentNode.removeChild(div); | |
// attach the div somewhere else | |
var footer = document.querySelector('.footer'); | |
footer.insertAdjacentHTML('afterend', div.outerHTML); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INPUT | |
let numbers = [1, 2, 3, 4]; | |
// MULTIPLY EACH ARRAY ITEM BY 2 | |
for (let i=0; i<numbers.length; i++) { | |
results.push(numbers[i]*2); | |
} | |
// OUTPUT | |
// [2, 4, 6, 8] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INPUT | |
let numbers = [1, 2, 3, 4]; | |
let results = []; | |
// MULTIPLY EACH ARRAY ITEM BY 2 | |
numbers.forEach(function (currentValue, index, arr) { | |
results.push(currentValue*2); | |
}); | |
// OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INPUT | |
let numbers = [1, 2, 3, 4]; | |
let results = []; | |
// MULTIPLY EACH ARRAY ITEM BY 2 | |
function multiplyBy2(currentValue, index, arr) { | |
return currentValue*2; | |
} | |
results = numbers.map(multiplyBy2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INPUT | |
let numbers = [1, 2, 3, 4]; | |
let results = []; | |
// MULTIPLY EACH ARRAY ITEM BY 2 | |
results = numbers.map(function (currentValue, index, arr) { | |
return currentValue*2; | |
}); | |
// OUTPUT |
OlderNewer