This file contains hidden or 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
program | |
.command('practice') | |
.alias('p') | |
.description('Starts typeracer in practice mode') | |
.action(() => | |
{ | |
game() | |
}) |
This file contains hidden or 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 stdin = process.stdin | |
const stdout = process.stdout | |
stdin.setRawMode(true) | |
stdin.resume() | |
require('readline').emitKeypressEvents(stdin) |
This file contains hidden or 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
/** | |
* @function updateWpm | |
*/ | |
function updateWpm () { | |
if (stringTyped.length > 0) { | |
wordsPermin = stringTyped.split(' ').length / (time / 60) | |
} | |
} |
This file contains hidden or 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
/** | |
* @function color | |
* @param {String} quote | |
* @param {String} stringTyped | |
*/ | |
function color (quote, stringTyped) { | |
let colouredString = '' | |
let wrongInput = false |
This file contains hidden or 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
/** | |
* @function Time | |
*/ | |
function Time () { | |
time = (Date.now() - timeStarted) / 1000 | |
} |
This file contains hidden or 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 roomNumber = crypto | |
.randomBytes(12) | |
.toString('base64') | |
.replace(/[+/=]+/g, '') |
This file contains hidden or 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
// Emitting client info on joining the room | |
_socket.on('room', function (val) { | |
_socket.emit('join', {roomName: val.value, username: data.username, number: data.number, randomNumber: data.randomNumber}) | |
}) |
This file contains hidden or 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
/** | |
* @function randomNumRetry | |
*/ | |
function randomNumRetry () { | |
randomNumber = Math.floor((Math.random() * paras.length)) | |
quote = paras[randomNumber].para | |
if (quote.length < 100) { | |
quote = paras[randomNumber].para + ' ' + paras[randomNumber - 1].para | |
} |
This file contains hidden or 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
// Getting documents from databse | |
Score.findOne({_id: process.env.ID}, (err, players) => { | |
if (err) throw new Error(err) | |
let playersArray = players.players.sort(function (a, b) { | |
return b.score - a.score | |
}) | |
let lowestScore = [] | |
lowestScore.push(playersArray[playersArray.length - 1].score) |
This file contains hidden or 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 gulp = require("gulp"); | |
const ts = require("gulp-typescript"); | |
const sourcemaps = require("gulp-sourcemaps"); | |
const tsProject = ts.createProject("tsconfig.json", { | |
typescript: require("typescript") | |
}); | |
gulp.task("build", () => { | |
gulp.src("process.yml") | |
.pipe(gulp.dest("dist")); |
OlderNewer