all: remove files that were accidentally checked in (#25882)

Introduced in this PR: https://github.com/sourcegraph/sourcegraph/pull/25379

cc @courier-new
This commit is contained in:
Tomás Senart 2021-10-11 13:08:38 +02:00 committed by GitHub
parent 4c7a760dd3
commit 77864fa87f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 474 deletions

3
.gitignore vendored
View File

@ -20,6 +20,9 @@
*.a
*.so
# C
*.dylib
# Mac OS X
.DS_Store

Binary file not shown.

237
sample.js
View File

@ -1,237 +0,0 @@
/**
* # LED numerals exercise
*
* Write a command line program which takes a number and displays the LED version of
* this number using underscores and vertical bars:
*
* $ led 757
* _ _ _
* | |_ |
* | _| |
*
* The first goal is just to get the above working. This likely will not take all of the
* time. Use the stretch goals below to fill the time:
*
* - Add a second parameter for bar length:
* $ led 757 2
* __ __ __
* | | |
* | |__ |
* | | |
* | __| |
* - How do we test this for correctness? Write the tests.
* - How do we test this for performance? Write the tests.
*/
const writeLED = led => {
let firstRow = ''
let secondRow = ''
let thirdRow = ''
// Split the LED number into digits
const digits = led.toString().split('')
// Get the LED pattern for each digit and build the rows with it
for (const digit of digits) {
firstRow += getTopLEDPattern(parseInt(digit, 10)) + ' '
secondRow += getMiddleLEDPattern(parseInt(digit, 10)) + ' '
thirdRow += getBottomLEDPattern(parseInt(digit, 10)) + ' '
}
console.log(`${firstRow}\n${secondRow}\n${thirdRow}`)
}
// TODO: Handle errors if digit > 9
const getTopLEDPattern = digit => {
switch (digit) {
case 0:
case 2:
case 3:
case 5:
case 6:
case 7:
case 8:
case 9:
return ' _ '
case 1:
case 4:
default:
return ' '
}
}
const getMiddleLEDPattern = digit => {
switch (digit) {
case 0:
return '| |'
case 1:
return ' | '
case 2:
case 3:
return ' _|'
case 4:
case 8:
case 9:
return '|_|'
case 5:
case 6:
return '|_ '
case 7:
default:
return ' |'
}
}
const getBottomLEDPattern = digit => {
switch (digit) {
case 0:
case 6:
case 8:
return '|_|'
case 1:
return ' | '
case 2:
return '|_ '
case 3:
case 5:
case 9:
return ' _|'
case 4:
case 7:
default:
return ' |'
}
}
// writeLED(1234567890)
// writeLED(10000)
const writeLED2 = (led, barLength = 1) => {
let topRow = ''
let topVerticalsRow = ''
let middleRow = ''
let bottomVerticalsRow = ''
let bottomRow = ''
// Split the LED number into digits
const digits = led.toString().split('')
// Get the LED pattern for each digit and build the rows with it
for (const digit of digits) {
topRow += getTopLEDPattern2(parseInt(digit, 10), barLength) + ' '
topVerticalsRow += getTopVerticalsRowLEDPattern(parseInt(digit, 10), barLength) + ' '
middleRow += getMiddleLEDPattern2(parseInt(digit, 10), barLength) + ' '
bottomVerticalsRow += getBottomVerticalsRowLEDPattern(parseInt(digit, 10), barLength) + ' '
bottomRow += getBottomLEDPattern2(parseInt(digit, 10), barLength) + ' '
}
const topVerticals = new Array(barLength - 1).fill(topVerticalsRow).join('\n')
const bottomVerticals = new Array(barLength - 1).fill(bottomVerticalsRow).join('\n')
console.log(
`${topRow}\n${topVerticals}${barLength > 1 ? '\n' : ''}${middleRow}\n${bottomVerticals}${
barLength > 1 ? '\n' : ''
}${bottomRow}`
)
}
// TODO: Handle errors if digit > 9
const getTopLEDPattern2 = (digit, barLength) => {
switch (digit) {
case 0:
case 2:
case 3:
case 5:
case 6:
case 7:
case 8:
case 9:
return ' ' + '_'.repeat(barLength) + ' '
case 1:
case 4:
default:
return ' ' + ' '.repeat(barLength) + ' '
}
}
const getTopVerticalsRowLEDPattern = (digit, barLength) => {
switch (digit) {
case 0:
case 4:
case 8:
case 9:
return '|' + ' '.repeat(barLength) + '|'
case 1:
case 5:
case 6:
return '|' + ' '.repeat(barLength) + ' '
case 2:
case 3:
case 7:
default:
return ' ' + ' '.repeat(barLength) + '|'
}
}
const getMiddleLEDPattern2 = (digit, barLength) => {
switch (digit) {
case 0:
return '|' + ' '.repeat(barLength) + '|'
case 1:
return '|' + ' '.repeat(barLength) + ' '
case 2:
case 3:
return ' ' + '_'.repeat(barLength) + '|'
case 4:
case 8:
case 9:
return '|' + '_'.repeat(barLength) + '|'
case 5:
case 6:
return '|' + '_'.repeat(barLength) + ' '
case 7:
default:
return ' ' + ' '.repeat(barLength) + '|'
}
}
const getBottomVerticalsRowLEDPattern = (digit, barLength) => {
switch (digit) {
case 0:
case 6:
case 8:
return '|' + ' '.repeat(barLength) + '|'
case 1:
case 2:
return '|' + ' '.repeat(barLength) + ' '
case 3:
case 4:
case 5:
case 7:
case 9:
default:
return ' ' + ' '.repeat(barLength) + '|'
}
}
const getBottomLEDPattern2 = (digit, barLength) => {
switch (digit) {
case 0:
case 6:
case 8:
return '|' + '_'.repeat(barLength) + '|'
case 1:
return '|' + ' '.repeat(barLength) + ' '
case 2:
return '|' + '_'.repeat(barLength) + ' '
case 3:
case 5:
case 9:
return ' ' + '_'.repeat(barLength) + '|'
case 4:
case 7:
default:
return ' ' + ' '.repeat(barLength) + '|'
}
}
// writeLED2(1234567890, 3)
writeLED2(parseInt(process.argv[2], 10), parseInt(process.argv[3], 10) || 1)

237
sample.ts
View File

@ -1,237 +0,0 @@
/**
* # LED numerals exercise
*
* Write a command line program which takes a number and displays the LED version of
* this number using underscores and vertical bars:
*
* $ led 757
* _ _ _
* | |_ |
* | _| |
*
* The first goal is just to get the above working. This likely will not take all of the
* time. Use the stretch goals below to fill the time:
*
* - Add a second parameter for bar length:
* $ led 757 2
* __ __ __
* | | |
* | |__ |
* | | |
* | __| |
* - How do we test this for correctness? Write the tests.
* - How do we test this for performance? Write the tests.
*/
export const writeLED = (led: number): void => {
let firstRow = ''
let secondRow = ''
let thirdRow = ''
// Split the LED number into digits
const digits = led.toString().split('')
// Get the LED pattern for each digit and build the rows with it
for (const digit of digits) {
firstRow += getTopLEDPattern(parseInt(digit, 10)) + ' '
secondRow += getMiddleLEDPattern(parseInt(digit, 10)) + ' '
thirdRow += getBottomLEDPattern(parseInt(digit, 10)) + ' '
}
console.log(`${firstRow}\n${secondRow}\n${thirdRow}`)
}
// TODO: Handle errors if digit > 9
const getTopLEDPattern = (digit: number): string => {
switch (digit) {
case 0:
case 2:
case 3:
case 5:
case 6:
case 7:
case 8:
case 9:
return ' _ '
case 1:
case 4:
default:
return ' '
}
}
const getMiddleLEDPattern = (digit: number): string => {
switch (digit) {
case 0:
return '| |'
case 1:
return ' | '
case 2:
case 3:
return ' _|'
case 4:
case 8:
case 9:
return '|_|'
case 5:
case 6:
return '|_ '
case 7:
default:
return ' |'
}
}
const getBottomLEDPattern = (digit: number): string => {
switch (digit) {
case 0:
case 6:
case 8:
return '|_|'
case 1:
return ' | '
case 2:
return '|_ '
case 3:
case 5:
case 9:
return ' _|'
case 4:
case 7:
default:
return ' |'
}
}
// writeLED(1234567890)
// writeLED(10000)
const writeLED2 = (led: number, barLength = 1): void => {
let topRow = ''
let topVerticalsRow = ''
let middleRow = ''
let bottomVerticalsRow = ''
let bottomRow = ''
// Split the LED number into digits
const digits = led.toString().split('')
// Get the LED pattern for each digit and build the rows with it
for (const digit of digits) {
topRow += getTopLEDPattern2(parseInt(digit, 10), barLength) + ' '
topVerticalsRow += getTopVerticalsRowLEDPattern(parseInt(digit, 10), barLength) + ' '
middleRow += getMiddleLEDPattern2(parseInt(digit, 10), barLength) + ' '
bottomVerticalsRow += getBottomVerticalsRowLEDPattern(parseInt(digit, 10), barLength) + ' '
bottomRow += getBottomLEDPattern2(parseInt(digit, 10), barLength) + ' '
}
const topVerticals = new Array(barLength - 1).fill(topVerticalsRow).join('\n')
const bottomVerticals = new Array(barLength - 1).fill(bottomVerticalsRow).join('\n')
console.log(
`${topRow}\n${topVerticals}${barLength > 1 ? '\n' : ''}${middleRow}\n${bottomVerticals}${
barLength > 1 ? '\n' : ''
}${bottomRow}`
)
}
// TODO: Handle errors if digit > 9
const getTopLEDPattern2 = (digit: number, barLength: number): string => {
switch (digit) {
case 0:
case 2:
case 3:
case 5:
case 6:
case 7:
case 8:
case 9:
return ' ' + '_'.repeat(barLength) + ' '
case 1:
case 4:
default:
return ' ' + ' '.repeat(barLength) + ' '
}
}
const getTopVerticalsRowLEDPattern = (digit: number, barLength: number): string => {
switch (digit) {
case 0:
case 4:
case 8:
case 9:
return '|' + ' '.repeat(barLength) + '|'
case 1:
case 5:
case 6:
return '|' + ' '.repeat(barLength) + ' '
case 2:
case 3:
case 7:
default:
return ' ' + ' '.repeat(barLength) + '|'
}
}
const getMiddleLEDPattern2 = (digit: number, barLength: number): string => {
switch (digit) {
case 0:
return '|' + ' '.repeat(barLength) + '|'
case 1:
return '|' + ' '.repeat(barLength) + ' '
case 2:
case 3:
return ' ' + '_'.repeat(barLength) + '|'
case 4:
case 8:
case 9:
return '|' + '_'.repeat(barLength) + '|'
case 5:
case 6:
return '|' + '_'.repeat(barLength) + ' '
case 7:
default:
return ' ' + ' '.repeat(barLength) + '|'
}
}
const getBottomVerticalsRowLEDPattern = (digit: number, barLength: number): string => {
switch (digit) {
case 0:
case 6:
case 8:
return '|' + ' '.repeat(barLength) + '|'
case 1:
case 2:
return '|' + ' '.repeat(barLength) + ' '
case 3:
case 4:
case 5:
case 7:
case 9:
default:
return ' ' + ' '.repeat(barLength) + '|'
}
}
const getBottomLEDPattern2 = (digit: number, barLength: number): string => {
switch (digit) {
case 0:
case 6:
case 8:
return '|' + '_'.repeat(barLength) + '|'
case 1:
return '|' + ' '.repeat(barLength) + ' '
case 2:
return '|' + '_'.repeat(barLength) + ' '
case 3:
case 5:
case 9:
return ' ' + '_'.repeat(barLength) + '|'
case 4:
case 7:
default:
return ' ' + ' '.repeat(barLength) + '|'
}
}
// writeLED2(1234567890, 3)
writeLED2(parseInt(process.argv[2], 10), parseInt(process.argv[3], 10) || 1)