The backend returns some optional fields but you want to write a function that makes those optional fields nullable. Why? No apperent reason.
type Response = {
name: string;
age?: number;
{% if permalink == "/" %} | |
{% set canonicalUrl = metadata.canonicalUrl %} | |
{% else %} | |
{% set canonicalUrl = metadata.canonicalUrl + page.url %} | |
{% endif %} | |
<link rel="canonical" href="{{ canonicalUrl }}"> | |
{# Social meta #} | |
{% if section == "articles" %} | |
<meta property="og:type" content="blog"> | |
{% else %} |
With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.
This document is a comparison of various ways the <script>
tags in HTML are processed depending on the attributes set.
If you ever wondered when to use inline <script async type="module">
and when <script nomodule defer src="...">
, you're in the good place!
Note that this article is about <script>
s inserted in the HTML; the behavior of <script>
s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)
license: lgpl-3.0 |
Tell us what was your approach with the project, i.e from the inspiration to the very first steps (sketches, tasks planning, design prototype, code prototype). Don't worry if the process was more "freestyle", if this is the case just describe how you wouly approach to a new project given an appropriate timeline.
Tell us about an interesting nontrivial bug/issue you encountered in your code and how you solved it, or if it's not solved yet, try to come up with a set of steps to fix it. It can be something related to external APIs, UI elements interactions, data visualization, build tooling etc..
Tell us about the library you used for the data visualizations and why you chose that one instead of others.
const canvasSketch = require('canvas-sketch'); | |
const { lerp } = require('./util/math'); | |
const settings = { | |
animate: true, | |
duration: 3, | |
dimensions: [ 640, 640 ], | |
scaleToView: true, | |
playbackRate: 'throttle', | |
fps: 24 |
Note:
When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.
If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:
Bear with me while I think aloud about this (please comment there, not here!). Goals:
Let's start with a single store that is external to the component tree. Our top-level <App>
component connects to it:
Early/simplifed version of You Draw It: What Got Better or Worse During Obama’s Presidency
d3.drag is pretty great!