Background:
Our API uses pagination on all lists. Every list endpoint returns an object like this:
{
"count": 14,
"next": http://stuff.com/page=2,
"previous": null,
"results": [...]
}
import { | |
BlogPost, NodeA, | |
NodeCode, | |
NodeCodeSection, | |
NodeContent, | |
NodeH1, | |
NodeH2, NodeImage, NodeItalic, NodeLi, NodeLink, NodeOl, NodeP, NodePostLink, NodeQuote, NodeSiteInfo, | |
NodeSpacer, NodeStrike, | |
NodeText | |
} from './blog-content.model.mjs'; |
// ESM - remove after ECMAScript Module support is past Experimental node v14 ? | |
require = require('esm')(module/*, options*/); | |
const { | |
NODE_TYPE_LI, | |
NODE_TYPE_P, | |
NODE_TYPE_A, | |
NODE_TYPE_BOLD, | |
NODE_TYPE_CODE, | |
NODE_TYPE_ITALIC, | |
NODE_TYPE_LINK, |
function killport() { | |
kill -kill `lsof -t -i tcp:$1` | |
} | |
export -f killport |
/* | |
We are implementing a `view` that must consume | |
some external service (which we've mocked below). The service returns | |
data that needs to be sanitized for client consumption -- in the | |
below example it includes sensitive information like SSN, email, etc.... The | |
exercises work through simple sanitizations, to slightly more complex | |
ones, before asking that the interviewee try to define a general approach | |
to solving the problem. | |
*/ | |
var _ = require('lodash'); |
/* | |
Please implement a function that compares two version numbers version1 and version2. | |
If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. | |
You may assume that the version strings are non-empty and contain only digits and the . character. | |
The . character does not represent a decimal point and is used to separate number sequences. | |
For instance, 2.5 is not "two and a half" or "half way to version three", it is the fifth second-level revision of the second first-level revision. | |
Here is an example of version numbers ordering: |
function getImportsFromFile(fileName) { | |
const readline = require('readline'); | |
const fs = require('fs'); | |
const imports = []; | |
return new Promise((resolve, reject) => { | |
const readStream = fs.createReadStream(fileName); | |
readStream.on('error', (err) => reject(err)); | |
const rl = readline.createInterface({input: readStream}); |
Background:
Our API uses pagination on all lists. Every list endpoint returns an object like this:
{
"count": 14,
"next": http://stuff.com/page=2,
"previous": null,
"results": [...]
}
#!/bin/bash | |
brew install nvm | |
nvm | |
mkdir ~/.nvm | |
cp $(brew --prefix nvm)/nvm-exec ~/.nvm/ | |
echo "export NVM_DIR=~/.nvm | |
source $(brew --prefix nvm)/nvm.sh" >> $HOME/.bashrc | |
nvm |
#!/usr/bin/env bash | |
if [ -z "$1" ] | |
then | |
echo "What should I kill?" | |
read line | |
else | |
line="$1" | |
fi | |
arr=($(sudo ps -A | grep "$line" | cut -d' ' -f1)) |