TLDR: Use for...of
instead of forEach()
in asynchronous code.
For legacy browsers, use for...i
or [].reduce()
To execute the promises in parallel, use Promise.all([].map(...))
const fs = require('fs'); | |
const filePath = 'file/path.json'; | |
const fileObject = JSON.parse(fs.readFileSync(filePath, 'utf8')); | |
// Do something with file | |
try { | |
fs.writeFileSync(filePath, JSON.stringify(fileObject, null, 2), 'utf8'); | |
console.log("The file was saved!"); |
Windows + x
a
(Selects PowerShell (Admin))cd ${HOME}\Downloads\fonts-master\fonts-master
)Set-ExecutionPolicy RemoteSigned
[1]y
then Enter
to acceptThanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.
This article is also on my blog: https://emilykauffman.com/blog/install-anaconda-on-wsl
Note: $
denotes the start of a command. Don't actually type this.
x86_64.sh
. If I had a 32-bit computer, I'd select the x86.sh
version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Anaconda3-5.2.0-LiUnfortunately nvm use
on Windows does not change the node version to that specified in the .nvmrc
file as its not supported on nvm for Windows: coreybutler/nvm-windows#388
So the easiest solution to this is to use a simple Powershell command that performs an approximation of the command as follows:
nvm use $(Get-Content .nvmrc).replace( 'v', '' );
However, thats a bit awkward and we can do a bit more so instead, we can create an 'alias' to a function that calls the command instead:
function callnvm() {
'use strict' | |
// examples from https://github.com/vriad/zod | |
// trying to use zod in JS w/ jsdoc type comments in vsCode | |
const z = require('zod') | |
const dogSchema = z.object({ | |
name: z.string(), |
using namespace System.Management.Automation | |
using namespace System.Management.Automation.Language | |
if ($host.Name -eq 'ConsoleHost') | |
{ | |
Import-Module PSReadLine | |
} | |
#Import-Module PSColors | |
#Import-Module posh-git | |
Import-Module -Name Terminal-Icons |
🚚 The bookmarklet has moved to https://github.com/bramus/mastodon-profile-redirect/