Skip to content

Instantly share code, notes, and snippets.

View marlenesco's full-sized avatar

David Foliti marlenesco

View GitHub Profile
@oliverjumpertz
oliverjumpertz / MyNFT.sol
Last active June 3, 2021 09:22
A basic ERC721 (NFT) implementation. Instantly runnable in remix.ethereum.org
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC721/ERC721.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/Counters.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/access/AccessControl.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/Context.sol";
contract MyNFT is Context, AccessControl, ERC721 {
@danieltxok
danieltxok / FID.js
Created February 17, 2021 11:22
FID Bookmarklet
javascript:
new PerformanceObserver((entryList)=>{
for (const entry of entryList.getEntries()) {
const delay = entry.processingStart - entry.startTime;
let consoleGroup = `%cFID value: ${Math.round(delay)}ms`;
let styles = '';
if (delay >= 100) {
styles = 'color: red;';
}
console.group(consoleGroup, styles);
@danieltxok
danieltxok / LCP.js
Created February 17, 2021 11:21
LCP Bookmarklet
javascript:
new PerformanceObserver((entryList)=>{
for (const entry of entryList.getEntries()) {
let consoleGroup = `%cLCP candidate: ${Math.round(entry.startTime)}ms`;
let styles = '';
if (entry.startTime >= 2500) {
styles = 'color: red;';
}
console.group(consoleGroup, styles);
console.log('Element:', entry.element);
@danieltxok
danieltxok / CLS.js
Created February 17, 2021 11:20
CLS Bookmarklet
javascript:
(function(){
try {
let cls = 0;
const canvas = document.createElement('canvas');
canvas.style.width = '100%';
canvas.style.height = '100%';
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
canvas.style.position = 'absolute';
@rauschma
rauschma / impatient-js-es2021.md
Last active August 31, 2023 07:02
ES2021 edition of “JavaScript for impatient programmers”

What is new in the ES2021 edition of “JavaScript for impatient programmers”?

Free to read online: exploringjs.com/impatient-js/

  • The exercises now run as native ESM modules on Node.js. Previously, they were run via the esm package.
  • Material on new ES2021 features:
    • String.prototype.replaceAll()
    • Promise.any()
    • Logical assignment operators
  • Underscores (_) as separators in number literals and bigint literals
@keithws
keithws / gtm-ipapi-tag.html
Created September 21, 2018 20:16
Google Tag Manager tag load GeoIP data into data layer from ipapi.co. Provides the data necessary to help with GDPR.
<script>
/*
* get geographical location data by ip address
* uses the free ipify.org service
* and the paid ipapi.co service
* and intelligent caching to minimize requests
*/
// mark the start of the script loading
@bvaughn
bvaughn / index.md
Last active April 3, 2024 07:41
Interaction tracing with React

This API was removed in React 17


Interaction tracing with React

React recently introduced an experimental profiler API. After discussing this API with several teams at Facebook, one common piece of feedback was that the performance information would be more useful if it could be associated with the events that caused the application to render (e.g. button click, XHR response). Tracing these events (or "interactions") would enable more powerful tooling to be built around the timing information, capable of answering questions like "What caused this really slow commit?" or "How long does it typically take for this interaction to update the DOM?".

With version 16.4.3, React added experimental support for this tracing by way of a new NPM package, scheduler. However the public API for this package is not yet finalized and will likely change with upcoming minor releases, so it should be used with caution.

@Ocramius
Ocramius / Caddyfile
Last active March 11, 2024 22:14
Example docker + docker-compose + caddy + traefik setup that routes to multiple apps from one exposed HTTP port
:80 {
root /serve
}
@berkedel
berkedel / flow-error-icu4c-not-loaded.md
Created April 4, 2018 14:13
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

How to solve dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

brew uninstall --ignore-dependencies node icu4c
brew install node
@lsv
lsv / README.md
Last active May 4, 2024 17:05
KNP Menu Bundle - Bootstrap 4 and Font Awesome 4