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
const http = require('http') | |
const fs = require('fs') | |
const path = require('path') | |
const extensionToContentType = { | |
'.js': 'application/javascript', | |
'.html': 'text/html' | |
} | |
http.createServer((req, res) => { |
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 {greetings} from './es6-modules-export.js' | |
greetings() |
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 function greetings() { | |
console.log('Hello, world') | |
} |
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
<script> | |
console.time('benchmark') | |
</script> | |
<script type="module"> | |
import itWorks from './es6-module-1.js' | |
const $ = document.querySelector.bind(document) | |
$('#output').textContent = itWorks() | |
console.timeEnd('benchmark') | |
</script> |
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
let driver | |
before(async () => { | |
driver = new webdriver.Builder().forBrowser('chrome').build() | |
}) | |
after(async () => await driver.quit()) |
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
const {Eyes} = require('eyes.selenium') | |
let eyes | |
before(async () => { | |
eyes = new Eyes() | |
eyes.setApiKey(process.env.APPLITOOLS_APIKEY) | |
await eyes.open(driver, 'Calculator App', 'Tests', {width: 800, height: 600}) | |
}) |
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
it('should look good', async function () { | |
await driver.get('http://localhost:8080') | |
await eyes.checkWindow('Initial Page') | |
const digit4Element = await driver.findElement(By.css('.digit-4')) | |
const digit2Element = await driver.findElement(By.css('.digit-2')) | |
const operatorMultiply = await driver.findElement(By.css('.operator-multiply')) | |
const operatorEquals = await driver.findElement(By.css('.operator-equals')) |
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
await retry(async () => { | |
const displayElement = await driver.findElement(By.css('.display')) | |
const displayText = await displayElement.getText() | |
expect(displayText).to.equal('0') | |
}) |
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
byte[] content = Files.readAllBytes(Paths.get("source.txt")); | |
Files.write(Paths.get("target.txt"), content); |
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
fs.readFile('source.txt', (_, content) => { | |
fs.writeFile('target.txt', content, () => { | |
console.log('done!') | |
}) | |
}) |