- Make sure you have configured git tools: see configuring tools.
- Make sure you have updated git aliases: see how to register aliases.
After each commit in our branch, in order to be up-to-date with the integration branch.
const isObject = (it) => it != null && typeof it === 'object'; | |
/** | |
* Encodes an object to be used as query-string. | |
* It uses 'encodeURIComponent' to set each value. | |
* | |
* @param {object} data an object with key-value pairs to create the query-string | |
* @returns {string} the query-string | |
*/ | |
function toUrlParams(data) { |
#!/bin/bash | |
# To create in [.babun/]cygwin/usr/local/bin/subl with chmod +x | |
ARGS="" | |
while test $# -gt 0 | |
do | |
ARGS="$ARGS ${1#/cygdrive/[a-zA-Z]}"; # Remove /cygdrive and disk letter from the path | |
shift | |
done |
- Make sure you have configured git tools: see configuring tools.
- Make sure you have updated git aliases: see how to register aliases.
After each commit in our branch, in order to be up-to-date with the integration branch.
C:/Users/username/
) called .ssh
.mkdir -p ~/.ssh
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no" /> |
Sometimes, debugging with console.log
is not enough to find out what is
happening in the code, as console.log
prints only plain objects but neither
functions nor objects with circular references. Besides, it's possible you
may need to know the context and flow of the code.
Read more about debugging with VS Code in VS Code: Debugging.
The way we usually debug JavaScript code, is through a web browser and typing
the keyword debugger
or console.log
in our files, but switching between
browser and VS Code can be annoying, and we also lose synchronization with
the source code.
VS Code provides the extension Debugger for Chrome which enables you to edit, debug, and set breakpoints to your JavaScript
import React from 'react'; | |
let lastScrollY = 0; | |
let ticking = false; | |
class App extends React.Component { | |
componentDidMount() { | |
window.addEventListener('scroll', this.handleScroll); | |
} |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
/** | |
* Gets all Reponse Headers for the current document. | |
* @returns An object cointaining the key-value pairs for each header | |
*/ | |
function getHeaders(url = document.location.href) { | |
const req = new XMLHttpRequest(); | |
req.open("GET", url, false); | |
req.send(null); | |
let key: string; |