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
const express = require("express"), | |
bodyParser = require("body-parser"), | |
cors = require("cors"), | |
{ auth } = require('express-openid-connect'), | |
EventEmitter = require('events'), | |
BASE_URL = process.env.BASE_URL || "http://localhost:5000", | |
PORT = process.env.PORT || 5000, | |
server = express(), | |
router = express.Router(), |
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 (w, doc) { | |
doc.addEventListener("DOMContentLoaded", function(){ | |
// Handler when the DOM is fully loaded | |
const trigger = document.querySelector('#content-loader'); | |
const output = document.querySelector('#output'); | |
const MOCK_SERVER_DATA = '<h1>Loaded Content</h1><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in volup |
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 (win,doc) { | |
doc.addEventListener("DOMContentLoaded", function() { | |
var el = document.querySelector('div.navPusher'); | |
// create wrapper container | |
var wrapper = document.createElement('main'); | |
wrapper.id = "main" | |
// insert wrapper before el in the DOM tree | |
el.parentNode.insertBefore(wrapper, el); |
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 (w, doc) { | |
doc.addEventListener("DOMContentLoaded", function(){ | |
const forEach = Array.prototype.forEach, | |
triggers = doc.querySelectorAll('button[data-trigger="alert"]'); | |
function generateAlert(opts) { | |
const alert = doc.createElement('pearson-alert'); | |
for (let attrName in opts) { | |
alert.setAttribute(attrName, opts[attrName]) |
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
// elements sdk | |
<ul class="pe-list pe-list--unstyled"> | |
<li>One</li> | |
<li>Two</li> | |
<li>Three | |
<ul class="pe-list pe-list--unstyled"> | |
<li>Three-One</li> | |
<li>Three-Two</li> | |
<li>Three-Three</li> | |
</ul> |
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
html { | |
box-sizing: border-box; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; | |
} |
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 multiply (a, b) { | |
return a * b; | |
} | |
// creates a new functions that changes the first argument a in multiply to 2 | |
var multiplyByTwo = multiply.bind(this, 2); | |
multiplyByTwo(4) | |
// returns 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
function makeGreeting (language) { | |
return function (firstname, lastname) { | |
if (language === 'en') { | |
return 'hello' + firstname + '' + lastname; | |
} | |
if (language === 'es') { | |
return 'hola' + firstname + '' + lastname; | |
} | |
} |
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 products = [ | |
{ name: 'cucumber', type: 'vegetable'}, | |
{ name: 'banana', type: 'fruit'}, | |
{ name: 'orange', type: 'fruit'} | |
]; | |
var filteredProducts = []; | |
// what we want to get away from | |
for (var i = 0; i < products.length; i ++) { |
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 numbers = [1,2,3]; | |
var doubledNumbers = []; | |
// want to move away from this | |
for (var i = 0; i < numbers.length; i++) { | |
doubledNumbers.push(numbers[i] * 2); | |
} | |
// creates a new array with values returned from function | |
var doubled = numbers.map(function(number){ |
NewerOlder