This file contains hidden or 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
| package main | |
| import ( | |
| "html/template" | |
| "net/http" | |
| "strconv" | |
| ) | |
| /*********************** | |
| This is a simple demonstration of how to use the built-in template package in Go to implement |
This file contains hidden or 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
| type CacheMetadata = { | |
| createdTime: number | |
| maxAge: number | null | |
| expires: number | null | |
| } | |
| function shouldRefresh(metadata: CacheMetadata) { | |
| if (metadata.maxAge) { | |
| return Date.now() > metadata.createdTime + metadata.maxAge | |
| } |
There are two primary approaches to page transitions (ignoring suspense's ditched attempt at a third)
- Indefinitely wait on the old screen
- Transition immediately to spinners/skeleton
Right now Remix has picked #1, but with a new export to a route module, we could support both.
Today, if you have this, Remix will wait for all data to load before displaying the page
This file contains hidden or 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 { createHttpLink } = require('apollo-link-http'); | |
| const fetch = require('node-fetch'); | |
| const store = require('store'); | |
| const sourceNodes = require('gatsby/dist/utils/source-nodes'); | |
| require('dotenv').config(); | |
| const craftGqlUrl = process.env.CRAFT_GQL_URL; | |
| const craftGqlToken = process.env.CRAFT_GQL_TOKEN; | |
| module.exports = { |
This file contains hidden or 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
| // See https://www.marcveens.nl/netlify-cms-generate-config-yml | |
| // https://www.netlifycms.org/docs/configuration-options/ | |
| type PublishMode = 'simple' | 'editorial_workflow'; | |
| type ExtensionType = 'yml' | 'yaml' | 'toml' | 'json' | 'md' | 'markdown' | 'html'; | |
| type FormatType = 'yml' | 'yaml' | 'toml' | 'json' | 'frontmatter' | 'yaml-frontmatter' | 'toml-frontmatter' | 'json-frontmatter'; | |
| type WidgetType = 'boolean' | 'date' | 'datetime' | 'file' | 'hidden' | 'image' | |
| | 'list' | 'map' | 'markdown' | 'number' | 'object' | 'relation' | |
| | 'select' | 'string' | 'text' | string; | |
| type MapType = 'Point' | 'LineString' | 'Polygon'; |
Testing double-fetching of module/nomodule JS code (including the Safari hack)
<script type="module" src="module.js"></script>
<script nomodule src="nomodule.js"></script>
Update September 2020: life's almost good. Edge Chromium is widely rolled out, and Safari 14.0 ships soon with a fix.
Test page: https://jg-testpage.github.io/es-modules/module-nomodule/
This file contains hidden or 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
| <?php | |
| namespace modules; | |
| use Craft; | |
| use markhuot\CraftQL; | |
| use yii\base\Event; | |
| const GOOGLE_API_KEY = 'YOUR_GOOGLE_API_KEY'; | |
| class Module extends \yii\base\Module |
This file contains hidden or 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 ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
| const path = require("path"); | |
| const glob = require("glob-all"); | |
| const PurgecssPlugin = require("purgecss-webpack-plugin"); | |
| /** | |
| * Custom PurgeCSS Extractor | |
| * https://github.com/FullHuman/purgecss | |
| * https://github.com/FullHuman/purgecss-webpack-plugin | |
| */ |
sorted by rerender time
| Solution | Use CSS | Use Inline-Styles | Mount Time (ms) | Rerender time (ms) |
|---|---|---|---|---|
| react (without styles) | - | - | 16.11 | 29.96 |
| styled-jsx-static | + | - | 25.27 | 42.24 |
| emotion-extract-static | + | + | 52.29 | 44.79 |
| react-css | + | + | 28.17 | 46.18 |
| styletron | + | - | 53.03 | 47.36 |
NewerOlder