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
mkdir -p new-dir/{foo,baz}/whatever-{1,2}/{a,b}; | |
exa --tree new-dir; | |
# new-dir | |
# ├── baz | |
# │ ├── whatever-1 | |
# │ │ ├── a | |
# │ │ └── b | |
# │ └── whatever-2 |
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 msg = 'This is a great message'; | |
msg.replace('great', 'wonderful'); | |
// "This is a wonderful message" | |
// | |
// -> 'great' is replaced by 'wonderful' | |
msg.replace('great', '$&-$&'); | |
// "This is a great-great message" | |
// '$&' represents the matched substring |
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
<link rel="preload" as="image" href="640.png" | |
imagesrcset="640.png 640w, 800.png 800w, 1024.png 1024w" | |
imagesizes="100vw"> | |
<!-- preload the correct image for the following element --> | |
<img src="640.png" | |
srcset="640.png 640w, 800.png 800w, 1024.png 1024w" | |
sizes="100vw"> |
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 { createRemoteFileNode } = require(`gatsby-source-filesystem`); | |
exports.onCreateNode = async ({ | |
actions, | |
node, | |
createNodeId, | |
store, | |
cache | |
}) => { | |
const { createNode } = actions; |
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> | |
<head> | |
<title>ES6 modules tryout</title> | |
<!-- does this make sense for es module supporting browsers --> | |
<!-- this works fine for Safari Preview but --> | |
<!-- this will now trigger downloads for browsers that don't understand type="module" :( --> | |
<link rel="preload" href="./dist/modules/dep-1.js" as="script"> | |
<link rel="preload" href="./dist/modules/dep-2.js" as="script"> | |
<!-- is there instead a way to detect ES module support and inject these with an inline script? --> |
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
javascript:( function() { | |
console.group( 'Performance Information for all entries of ' + window.location.href ); | |
console.log( '\n-> Duration is displayed in ms\n ' ) | |
var entries = window.performance.getEntries(); | |
entries = entries.sort( function( a, b ) { | |
return b.duration - a.duration; | |
} ); | |
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 (migration) { | |
// create a new content type “Conference” | |
const conference = migration.createContentType('conference') | |
.name('Conference/Meetup') | |
.displayField('name') | |
// set up the new fields | |
conference.createField('name').type('Symbol').required(true).name('Conference/Meetup name') | |
conference.createField('country').type('Symbol').required(true).name('Country Code') | |
conference.createField('city').type('Symbol').required(true).name('City') |
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
import dep2 from './dep-2.js'; | |
export default function() { | |
return dep2(); | |
} |