Debugging Node.js in a Docker container
First, we’ll need to create a Dockerfile,
FROM node
function calculateAdditionalStocks(initialStocks, initialPrice, currentPrice, targetPrice) { | |
const initialInvestment = initialStocks * initialPrice; | |
const currentHoldingValue = initialStocks * currentPrice; | |
const loss = initialInvestment - currentHoldingValue; | |
const additionalInvestmentNeeded = initialInvestment - targetPrice * initialStocks; | |
const additionalStocks = Math.ceil(additionalInvestmentNeeded / currentPrice); | |
return additionalStocks; | |
} |
#!/bin/bash | |
# this file recursively traverse through each sub-folder inside the parent folder | |
# it performs the git actions e.g. stash, rebase from main and move on as specified | |
# it also waits for manual conflict resolution if necessary | |
# set permission for this file: chmod +x checkout-all-repos.sh | |
# execute the script: `./checkout-all-repos.sh` | |
Debugging Node.js in a Docker container
First, we’ll need to create a Dockerfile,
FROM node
Go to SourceTree > Preferences > Git > Git Version (section)
Select "Reset to Embedded Git"
Note: Do not use the system version of git
Now you need to add path of git-crypt
as a symlink
From https://jira.atlassian.com/browse/SRCTREE-2511 : The easiest solution would be to symlink git-crypt1 to the same location as your
git` binary due to variations in how to configure (per major OS revision)
Locate your SourceTree installation directory
Locate the embedded git path. This is usually /Applications/Sourcetree.app/Contents/Resources/git_local/bin/
Run which git-crypt
# For newer Mac OS versions where zsh is the default terminal | |
$ nano ~/.zshenv | |
# For older Mac OS versions where bash is the default terminal | |
$ nano ~/.bash_profile | |
# add the following two entries in ~/.zshenv | |
export JAVA_HOME=$(/usr/libexec/java_home) | |
export PATH=/correct/path/to/apache-maven-3.8.6/bin:$PATH |
html, body { | |
background: #111; | |
color: white; | |
height: 100%; | |
} | |
canvas { | |
display: none; | |
height: auto; | |
object-fit: contain; |
function Person(name) { | |
this.name = name; | |
} | |
const a = new Person("a"); | |
try { | |
console.log(a.getName()); // Output: TypeError: a.getName is not a function | |
} catch (e) { | |
console.error(e); |
var _createClass = (function () { | |
function defineProperties(target, props) { | |
for (var i = 0; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
descriptor.writable = true; | |
} | |
Object.defineProperty(target, descriptor.key, descriptor); |
var input = [11, 12, 13, 55, 34, 66, 88, 12, 98, 67, 12, 66, 53, 23]; | |
console.log(`input size is ${input.length}`); | |
(function theSindresorhusApproach() { | |
// the sindresorhus approach | |
function* play() { | |
let h = {}; | |
input.map((i) => (h[i] = i)); |
// The native unescape or decodeURI or decodeURIComponent is not suitable for this job | |
// Instead, take the escaped HTML entity and set it as innerHTML | |
// Then, extract the innerText | |
// The complete list of HTML entities with their numbers and names can be found here. | |
// This page also includes full list of ASCII characters that can be represented in HTML. | |
// https://www.freeformatter.com/html-entities.html | |
d = document.createElement('div'); d.innerHTML = '!'; d.innerText; |