Skip to content

Instantly share code, notes, and snippets.

View Zizzamia's full-sized avatar

Leonardo Zizzamia Zizzamia

View GitHub Profile
pragma solidity ^0.5.0;
contract SimpleBank {
mapping (address => uint) private balances;
address public owner;
constructor() public {
owner = msg.sender;
}
import Loadable from 'react-loadable';
export const LazyListComponent = Loadable({
loader: () => import(/* webpackChunkName: "listComponent" */ './ListComponent'),
loading: () => null,
delay: 300,
});
const perfume = new Perfume({
firstPaint: true
});
// ⚡️ Perfume.js: First Contentful Paint 1482.00 ms
@Zizzamia
Zizzamia / tti-perfume-demo.html
Last active October 9, 2018 02:54
TTI Perfume demo
<head>
<script src="perfume.js"></script>
<style>body { background: #f2db77; ... } .progress { ... }</style>
</head>
<body>
...
<script>
const perfume = new Perfume({
timeToInteractive: true,
});
@Zizzamia
Zizzamia / tti-polyfill-demo.html
Last active October 9, 2018 02:54
tti-polyfill demo
<head>
<script>
!function(){if('PerformanceLongTaskTiming' in window){var g=window.__tti={e:[]};
g.o=new PerformanceObserver(function(l){g.e=g.e.concat(l.getEntries())});
g.o.observe({entryTypes:['longtask']})}}();
</script>
<style>body { background: #f2db77; ... } .progress { ... }</style>
</head>
<body>...</body>
<script src="tti-polyfill.js"></script>
@Zizzamia
Zizzamia / first-contentful-paint-native-demo.html
Last active April 11, 2018 21:36
First Contentful Paint native demo
<head>
<script>
const perfObserver = new PerformanceObserver((entryList) => {
console.log(...entryList.getEntries());
});
perfObserver.observe({entryTypes: ["paint"]});
</script>
<style>body { background: #f2db77; ... }</style>
</head>
<body></body>
@Zizzamia
Zizzamia / perfume-fcp-demo.html
Last active October 9, 2018 02:51
Perfume FCP demo
<head>
<script src="perfume.js"></script>
<style>body { background: #f2db77; ... }</style>
</head>
<body></body>
<script>
const perfume = new Perfume({
firstPaint: true,
firstContentfulPaint: true,
});
@Zizzamia
Zizzamia / performance-paint-timing-fcp.js
Created March 9, 2018 00:56
performancePaintTiming FCP
const performancePaintTiming = {
name: "first-contentful-paint",
entryType: "paint",
startTime: 1030.3000000021711,
duration: 0
}
@Zizzamia
Zizzamia / performance-paint-time-fp.js
Last active March 10, 2018 06:22
PerformancePaintTiming FP
const performancePaintTiming = {
name: "first-paint",
entryType: "paint",
startTime: 431.10000000160653,
duration: 0
};
@Zizzamia
Zizzamia / first-contentful-paint.js
Last active March 13, 2018 04:48
First (Contentful) Paint
const perfObserver = new PerformanceObserver((performanceEntryList) => {
for (const performanceEntry of performanceEntryList.getEntries()) {
console.log(performanceEntry.name); // 'first-paint' or 'first-contentful-paint'
console.log(performanceEntry.startTime); // DOMHighResTimeStamp
}
});
perfObserver.observe({ entryTypes: ["paint"] });