View Pagination.spec.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
const Pagination = require("./Pagination").Pagination; | |
describe("Pagination", () => { | |
describe(".fromResult", () => { | |
it("calculates the index of the first result on the current page", () => { | |
const instance = new Pagination({ | |
totalResults: 25, | |
resultsPerPage: 10, | |
currentPage: 2, | |
}); |
View fileUtils.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
const fs = require('fs'); | |
const glob = require('glob'); | |
/** | |
* Find files | |
* @param {String} globPattern | |
* @returns {Promise<String[]>} | |
*/ | |
function findFiles(globPattern) { | |
return new Promise((resolve, reject) => { |
View instrumentRequests.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
// Based on <https://blog.bearer.sh/http-api-instrumentation-nodejs/> | |
const http = require("http"); | |
const https = require("https"); | |
const { performance } = require("perf_hooks"); | |
function patchModule(module) { | |
const original = module.request; | |
function newRequest(outgoing) { | |
// Using perf.now() instead of Date.now() not because we need the resolution |
View upload-to-s3.sh
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
#!/bin/bash | |
SOURCE_FILES=($(find public/*.{js,css,gz,br,map} 2>/dev/null)) | |
DESTINATION_BUCKET="hashed-assets-eu" | |
DESTINATION_FOLDER="page-kit" | |
for FILE in ${SOURCE_FILES[@]}; do | |
if [[ $FILE == *".gz" ]]; then |
View fetch.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
const nodeFetch = require('node-fetch'); | |
const httpsAgent = require('./httpsAgent'); | |
const handleResponse = require('./handleResponse'); | |
module.exports = async (url, options = {}) => { | |
const response = await nodeFetch(url, { | |
...options, | |
agent: httpsAgent | |
}); | |
View hyperons.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
(function (global, factory) { | |
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | |
typeof define === 'function' && define.amd ? define(['exports'], factory) : | |
(global = global || self, factory(global.hyperons = {})); | |
}(this, function (exports) { | |
'use strict'; | |
/** | |
* Base Component class | |
* @param {object} props The initial component props |
View highlight.scss
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
.highlight { background: #282A3A; color: #EAF2F1 } | |
.ge { font-style: italic } // Generic.Emph | |
.gs { font-weight: bold } // Generic.Strong | |
.gi { color: #BAD761 } // Generic.Inserted | |
.gd { color: #FF657A } // Generic.Deleted | |
.err { color: #FF657A } // Error | |
.nc, // Name.Class |
View index.html
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Preact Compat onChange normalization</title> | |
</head> | |
<body> | |
<div id="app"></div> | |
<script src="dist/main.js"></script> | |
</body> |
View ads.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
'use strict' | |
const CLASSNAME_WAITING = 'is-waiting' | |
const CLASSNAME_LOADING = 'is-loading' | |
const CLASSNAME_PREROLL = 'is-preroll' | |
const CLASSNAME_PLAYING = 'is-playing' | |
const CLASSNAME_PROBLEM = 'is-problem' | |
// <https://developers.google.com/interactive-media-ads/docs/sdks/html5/sdk-player> | |
function ads (target) { |
View toggle.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
module.exports = function (buttons, target, callback) { | |
buttons = buttons.length === undefined ? [ buttons ] : Array.from(buttons); | |
const toggle = function (e) { | |
const state = target.classList.toggle('is-active'); | |
buttons.forEach(button => { | |
button.setAttribute('aria-expanded', state); | |
}); |
NewerOlder