Skip to content

Instantly share code, notes, and snippets.

@hakimelek
hakimelek / webperf.js
Created August 22, 2017 20:18
Web performance object
/**
* Web performance object example:
*/
import 'performance-polyfill';
class WebPerfMetrics {
constructor() {
this.performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {};
this.timing = (this.performance && this.performance.timing) ? this.performance.timing : null;
Verifying my Blockstack ID is secured with the address 1Mz5PM3Ag4H3V6kEo63zHLKpTx7piuVNk4 https://explorer.blockstack.org/address/1Mz5PM3Ag4H3V6kEo63zHLKpTx7piuVNk4
Array(100)
.fill(0)
.map((a, i) => i+1)
.forEach(num => {
if (num % 3 === 0 && num % 5 === 0) return console.log('CracklePop')
else if (num % 3 === 0) return console.log('Crackle')
else if (num % 5 === 0) return console.log('Pop')
return console.log(num)
})
@hakimelek
hakimelek / script.js
Created June 29, 2018 15:53
Detect Latest Image loaded on the page
const imagePath = '/path/to/image'
let latestImageTiming = 0
const p = window.performance.getEntriesByType('resource')
p.filter(e => { e.name.indexOf(imagePath) >= 0 && (latestImageTiming = Math.max(latestImageTiming, e.responseEnd))})
console.log(latestImageTiming)
@hakimelek
hakimelek / priceline.com.har
Created February 26, 2019 22:47
HAR file for Priceline.com
This file has been truncated, but you can view the full file.
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.36"
},
"pages": [
{
"startedDateTime": "2019-02-25T15:10:35.824Z",
@hakimelek
hakimelek / sitemap.xml
Last active July 6, 2022 13:33
Priceline Demo Sitemap
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.priceline.com/</loc>
<lastmod>2022-07-06</lastmod>
</url>
<url>
<loc>https://www.priceline.com/hotels</loc>
<lastmod>2022-07-06</lastmod>
</url>