- How the browser renders the document
- Receives the data (bytes) from the server.
- Parses and converts into tokens (<, TagName, Attribute, AttributeValue, >).
- Turns tokens into nodes.
- Turns nodes into the
DOM
tree.
- Builds
CSSOM
tree from thecss rules
.
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
/* http://meyerweb.com/eric/tools/css/reset/ | |
v5.0.2 | 20191019 | |
License: none (public domain) | |
*/ | |
html, | |
body, | |
div, | |
span, | |
applet, |
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
export const isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i; |
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
class LinkedListNode { | |
constructor(value) { | |
this.next = null; | |
this.value = value; | |
} | |
} | |
class LinkedList { | |
constructor() { | |
this.head = null; |
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
function _get(obj, path, _default) { | |
if (typeof obj !== "object") { | |
throw new Error("param 1 must be an object") | |
} | |
if (typeof path !== "string" && !Array.isArray(path)) { | |
throw new Error("param 2 must be an object or a string") | |
} | |
let _path = path |
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
function getArrayBuffer(file) { | |
return new Promise((resolve, reject) => { | |
const reader = new FileReader(); | |
reader.addEventListener('load', () => { | |
resolve(reader.result); | |
}); | |
reader.addEventListener('error', () => { | |
reject(); | |
}); |
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 { useEffect } from 'react' | |
import Script from 'next/script' | |
import { useRouter } from 'next/router' | |
import * as gtag from './gtag' | |
const App = ({ Component, pageProps }) => { | |
const router = useRouter() | |
useEffect(() => { | |
const handleRouteChange = (url) => { | |
gtag.pageview(url) |
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
// Set an error message and redirect | |
var redirectWithMessage = function (message, url, req, res) { | |
req.session.messages = message; | |
res.redirect(url); | |
}; | |
// Return 'messages' value or null instead | |
var getMessages = function (req) { | |
var messages = req.session.messages || null; | |
delete req.session.messages; |
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
# Note (November 2016): | |
# This config is rather outdated and left here for historical reasons, please refer to prerender.io for the latest setup information | |
# Serving static html to Googlebot is now considered bad practice as you should be using the escaped fragment crawling protocol | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name yourserver.com; | |
root /path/to/your/htdocs; |
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
function bubbleSort(arr) { | |
for(var i = 0; i < arr.length; i++) { | |
if(arr[i] > arr[i + 1]) { | |
var tmp = arr[i + 1]; | |
arr[i + 1] = arr[i]; | |
arr[i] = tmp; | |
} | |
} |
NewerOlder