Giter Club home page Giter Club logo

typeracer-cli's Introduction

Practice touch typing and compete with your friends all from the comfort of your shell and become a typing ninja ๐Ÿ’ฅ.

Build Status Codacy Badge

But this has already been done. Why should I use this client?

Because most other shell clients don't offer the features that we do

Features

  • Practice mode (offline mode)
  • User stats (words per minute, time taken)
  • Online mode (have a type-race by spawning up a server and sharing it with your friends)
  • Ask for a rematch after the race ends (online mode)
  • Can view the top 10 Highscores in online mode

Installation

run npm i --global typeracer-cli from your command line

Possible Errors

When you have installed this tool some times later you could find some error when you start typerace.

This may be because new update might have been rolled out and you have to update to latest version.

How to update

Its same as installation just run npm i --global typeracer-cli from your command line

Now even after that if you see any errors, follow the below steps

  • find .nvm folder in your home directory.

  • cd to .nvm/versions/node/${your node version}/bin and delete typerace file

  • cd to .nvm/versions/node/${your node version}/lib/node_modules and delete typeracer-cli folder

  • run npm - -global typeracer-cli

These steps should resolve the isssue. If it does not please open an isssue.

Usage

run typerace or typerace -h to its usage

Output

Usage: typerace [options] [command]

  Options:

    -h, --help          output usage information

  Commands:

    practice|p          Start typeracer
    online|o [options]  Start game in online mode

Practice mode

  • typerace p to start practice mode.

Preview of practice mode

practice

Online mode

Prevew of online mode

online

  • typerace o -f to start online mode which will prompt a question

Are you starting server for race (y/N) ?

Now 2 cases are there

  • If yes

    • You will share Room to join for race, Number of racers, Number(sort of password)
    • All the above will be prompted if you select yes and all of your friends should fill them out same.
  • If no

    • Ask for Room to join for race, Number of racers, Number(sort of password) from your friend who created a private room to race.

Highscores

To view the top 10 Highscores in online mode.

run typerace o -s

Enjoy ๐Ÿ”ฅ

Contributing

If you think of a feature enhancement or find a bug kindly raise an issue. We also welcome you to work on your issues by just commenting down on them with "I would like to work on this". All contributions are appreciated.

General Setup

  • fork the repository

  • clone your forked repository

  • set the upstream remote

  • cd to folder and run npm install

  • create a .env file in root directory and put following in it

DATABASE=your mongoDB url
  • run npm start

But I don't know how to code, is there any other way I can contribute?

Yes, ofcourse you can we need lots of paragraphs so that our users don't get bored by typing out the same text over and over again. To add a paragraph follow these steps:

  • Add paragraphs in paragraphs/para.json
  • run npm test
  • Important: all tests should pass as you would get a test failure for duplicate paragraphs.
  • Find same paragraphs then run npm test
  • If all tests pass locally then Open a PR

Support Us

We are a bunch of undergrads passionate about software development looking to make cool stuff. A little motivation and support helps us a lot. If you like this nifty hack you can support us by doing any (or all ๐Ÿ˜‰ ) of the following:

  • โฌ†๏ธ Upvote on producthunt producthunt
  • โญ Star us on Github and make us trend so that other people can know about our project.
  • ๐Ÿ‘ Clap for us on Medium
  • Tweet about us
  • Share this on Facebook
  • Install it and increase our download count on npm
  • Donation (Coming Soon)

Contributors

typeracer-cli's People

Contributors

arsalanhub avatar debck avatar filtermap avatar iamravitejag avatar knrt10 avatar learningmonkey61 avatar palash25 avatar quarantinex avatar rajukalidindi avatar tomimara52 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

typeracer-cli's Issues

Errors and conflicts

When I tried out the practice mode today I got this

net.js:705
    throw new errors.TypeError('ERR_INVALID_ARG_TYPE',
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be one of type string or Buffer. Received type number
    at WriteStream.Socket.write (net.js:705:11)
    at Timeout.setInterval (/home/palash25/Dev/Projects/psoc/typeracer-cli/scripts/game.js:146:14)
    at ontimeout (timers.js:478:11)
    at tryOnTimeout (timers.js:302:5)
    at Timer.listOnTimeout (timers.js:262:5)

so I did a pull and I'm getting a merge conflict for some reason even though my repo is clean

 โœ˜ palash25@Lenovo-G50 ๎‚ฐ ~ ๎‚ฐ hack psoc
 palash25@Lenovo-G50 ๎‚ฐ ~/Dev/Projects/psoc ๎‚ฐ cd typeracer-cli 
 palash25@Lenovo-G50 ๎‚ฐ ~/Dev/Projects/psoc/typeracer-cli ๎‚ฐ ๎‚  master ๎‚ฐ git pull origin master
remote: Counting objects: 40, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 40 (delta 21), reused 39 (delta 20), pack-reused 0
Unpacking objects: 100% (40/40), done.
From https://github.com/p-society/typeracer-cli
 * branch            master     -> FETCH_HEAD
 + ed12cc1...121b8e2 master     -> origin/master  (forced update)
Auto-merging online/client.js
CONFLICT (content): Merge conflict in online/client.js
Automatic merge failed; fix conflicts and then commit the result.
 โœ˜ palash25@Lenovo-G50 ๎‚ฐ ~/Dev/Projects/psoc/typeracer-cli ๎‚ฐ ๎‚  master โ—โœš >M< ๎‚ฐ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

removed 1 package in 21.355s
 palash25@Lenovo-G50 ๎‚ฐ ~/Dev/Projects/psoc/typeracer-cli ๎‚ฐ ๎‚  master โ—โœš >M< ๎‚ฐ npm link
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

up to date in 6.68s
/home/palash25/.npm-packages/bin/typerace -> /home/palash25/.npm-packages/lib/node_modules/typeracer-cli/index.js
/home/palash25/.npm-packages/lib/node_modules/typeracer-cli -> /home/palash25/Dev/Projects/psoc/typeracer-cli
 palash25@Lenovo-G50 ๎‚ฐ ~/Dev/Projects/psoc/typeracer-cli ๎‚ฐ ๎‚  master โ—โœš >M< ๎‚ฐ typerace p
/home/palash25/Dev/Projects/psoc/typeracer-cli/online/client.js:100
<<<<<<< HEAD
^^

SyntaxError: Unexpected token <<
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:152:10)
    at Module._compile (module.js:605:28)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/palash25/Dev/Projects/psoc/typeracer-cli/index.js:9:16)

cc @knrt10 @IamRaviTejaG

LOGO

Please suggest any changes in logo.

'typerace' leaves the terminal session unresponsive

Running typerace simply renders the terminal unresponsive.

OS:
Windows 10 Home Build 1803.

Current Behavior:
When typerace is run, the terminal session becomes unresponsive. Even Ctrl-C won't work.

Expected Behavior:
typerace should throw in a list of all commands (simply what typerace -h does now).

Screenshot:
capture

font color

Hi, is it possible to make the font color more brighter for correct text you type.

Argument for specifying custom para.json paragraph source

para.json is hardcoded and cannot be updated in any way, forcing the user to patch the file manually where the installation has occurred. I propose an argument -s, --source, which takes in the path for the source file and use that instead.

para.json: Remove all lengthy paragraphs

Paragraphs with ID 01-20 (excluding 11 & 14) need to be removed from para.json for they are very long.

PS: Those were my initial contributions, hearty apologies for that.

Proble when second round starts.

screenshot from 2018-05-08 03-54-59
In online mode
Game Starting in X sec
X goes from -4 to +infinity when ENTER is pressed more than once at beginning of second round. The color of the to-be-typed sentence changes even if one letter is typed.

Screen flickering in kitty terminal

Screen keep flickering with every letter I type in kitty terminal and the flickering is increased the further I go in the sentence.
I tried it in 4 different terminals
worked fine in konsole and mate-terminal
screen flickered in kitty and xterm

Displaying author field in the prompt

Currently, the randomQuote function extracts the para field from the array from para.json

  1. It seems like id field is not needed
  2. The author field should be underneath the quote displayed as a read-only attribution

Features to add

To-Do

  • Restart mode.
  • Request rematch.
  • Add more paragraphs.
  • Top 10 High scores.
  • Add badges {Messi, Ronaldo for legends}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.