GithubHelp home page GithubHelp logo

cpinitiative / ide Goto Github PK

View Code? Open in Web Editor NEW
339.0 339.0 36.0 6.55 MB

A realtime collaborative IDE with code execution, intellisense, mobile support, and built-in USACO submissions.

Home Page: https://ide.usaco.guide/

License: Mozilla Public License 2.0

JavaScript 55.68% CSS 0.25% TypeScript 44.00% HTML 0.06%

ide's Introduction

Competitive Programming Initiative

We promote competitive programming among students through resources, outreach, classes, and contests.

Thanks to Vercel for providing free hosting & continuous deployment!

Development Environment Setup

Instructions (for volunteer hours -- not necessarily needed for other stuff)

  1. If not done already, clone the repository cpinitiative/cpinitiative and open up the folder.

  2. At the root directory, add a file .env, which will contain the environment configuration for the volunteer-hours. An example .env file will look like

    GOOGLE_CLIENT_ID="....apps.googleusercontent.com"
    GOOGLE_CLIENT_SECRET="asdkjflasdjfklas"
    NEXTAUTH_URL="http://localhost:3000"
    SHEETS_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----..."
    SHEETS_PRIVATE_KEY_ID="1298301asfa98sf09ac0291023"
    FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----..."
    ENCRYPTION_KEY="asdjkflajsdflkjas;ldjfa"
    MJ_APIKEY_PUBLIC="mailjet api key public"
    MJ_APIKEY_PRIVATE=""
    PAYPAL_API_SECRET="ddd"
    MAILGUN_API_KEY=""

    Here's how to get the following keys:

    • Google Sheets: https://developers.google.com/sheets/api/guides/authorizing#APIKey
    • NEXT_AUTH_URL: choose the address of deployment
    • FIREBASE_PRIVATE_KEY -- I don't think this is even needed??
    • ENCRYPTION_KEY -- ask Nathan (or modify cryptography file), used to decrypt firebase key on vercel
    • MJ_APIKEY_PUBLIC/PRIVATE -- ask Nathan, only needed for newsletter
    • MAILCHIMP_API_KEY -- ask Nathan, only needed for class registration system
    • PAYPAL_API_SECRET -- ask Nathan, only needed for class registration system
  3. Using the correct configuration file, go into SHEETS_API_CREDS inconfig.ts and make sure the credential object matches your Google Sheet configuration that you retrieved in the previous step.

  4. Acquire firebase credentials (or setup emulator), and make sure to replace the configuration in the firebaseAdmin.initializeApp in firebase.ts with the correct configuration.

  5. To navigate to the volunteer hours page after running yarn dev, you can go to localhost:3000/view-hours. Then, it should be able to test.

  6. Make sure to add access to the sheet in mind through Google Sheets itself (add the service account email as an editor in the sheet)

Here is a sample entry in the table, for reference, which can be called with the google-spreadsheet node package, :

Timestamp What is your name? What is your email address? List any PR's that you reviewed or submitted this week. How many hours did you spend on the USACO Guide this week? Enter only a number. (Optional, only if you want volunteer hours) Anything else you want to tell us? (Optional)
2021-10-23T23:18:42.653Z Someone [email protected] I worked on pull requests and reviewed things. 4 Yes, I made some stuff.

ide's People

Contributors

96f4 avatar asynchronousai avatar bertaland avatar bqi343 avatar danielzsh avatar ericshu6 avatar gilgameshxzero avatar inkitori avatar maggie-j-liu avatar sharad-sharma avatar shaubby avatar thecodingwizard 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

ide's Issues

userSettingsAtom

we should move defaultPermission into an atom
and then read that atom in joinNewWorkspaceAsOwnerAtom
ie. maybe we should make a userSettingsAtom that synchronizes settings to firebase, and can store:

  • name
  • editorMode
  • defaultPermission
  • color
  • defaultLanguage
  • defaultTemplate
  • etc

Option to load individual test cases for USACO

Target use case: if a user gets a particular test case wrong after submitting, the user can then click on the test case to load that test case and get the input + expected output.

I forgot how big exactly all the USACO test files are, but I recall it wasn't very big at all. We could just write a script to download all the test cases and upload it to the server

Can't run code locally...

After following the instructions to start a local development server and doing yarn dev, I ended up with a bunch of ERR_UNSUPPORTED_DIR_IMPORT errors.

Does anyone know how to fix this? I want to check out the codebase lol

Thanks!
image

Tabs vs. spaces?

As far as I can tell, the IDE always indents with tabs rather than spaces. It would be nice if there was a setting to change whether the IDE uses tabs or spaces and also a setting to adjust indent size.

Thanks!

Display output to all users

Amazing project, kudos to all developers! :)
As far as I see, the output of the program (stdout and stderr), and the compile output only arrives to that user who pressed the Run Code button. It would be great if everyone watching could see the same result. Do you think it can be done?

Copy file button not working

when you haven't added anything to the 3 code editors or the scribble editor, vercel error should explain why

Console:
image

From Vercel:
image

No response when click Insert File Template

Hi @cpinitiative this is an excellent project, but it seems there is a small bug, when I click the Insert File Template in File, the website has no response but just warns Reset current file? Any changes you made will be lost.

image

All code in Main.cpp has been reset, but I still can't upload my template file.

My broswer edition is chrome 89.0.4389.114, then I change to firefox 88.0, it also responses nothing.

Maybe it's a feature which is being developed.

As for another suggestion, it would be better if supports display all files in sidebar likes nerdtree.

Thanks!

Title of the Tab

When I visit a workspace and then go the home page , the title of the tab in the browser is not changing
Here is the title :

Screen Shot 2022-02-05 at 4 37 36 PM

Thanks

Dashboard Updates

  • Option to hide (or delete?) files as mentioned in #7.
    • There should still be an option to toggle showing recently hidden files in case you hid one by accident.
  • Toggle default file permissions.

USACO IDE File Download

This isn't a big issue but downloading files from the USACO IDE that CPI created saves the file as main.cpp. Renaming this for every file that is created as well as any time I download, submit, fix something, and then download again to resubmit is a huge pain. I also like to keep the files of each problem I solve for personal storage, but I don't think this is a bad idea. A possible solution would be titling the final [chosennameofproject].cpp.

Integrate w/ USACO Monthly Table

Could add an extra option in the dropdown to open a new file in the IDE corresponding to that problem (or open an existing file if the user already owns one for that problem).

Screen Shot 2021-06-20 at 9 20 29 PM

Display Compile Output Even if Compilation Exceeds

Ex. https://ide.usaco.guide/MsXySNwQ8SR4gQKNu9w should display a warning like this:

Main.cpp: In function ‘int main()’:
Main.cpp:8:22: warning: ‘a’ is used uninitialized [-Wuninitialized]
    8 |         cout << a << " " << b << " " << c;
      |                      ^~~
Main.cpp:8:34: warning: ‘b’ is used uninitialized [-Wuninitialized]
    8 |         cout << a << " " << b << " " << c;
      |                                  ^~~
Main.cpp:8:41: warning: ‘c’ is used uninitialized [-Wuninitialized]
    8 |         cout << a << " " << b << " " << c;
      |                                         ^

but currently it displays nothing.

CSAcademy does this.

USACO Judge Settings carry over to new file

Steps to reproduce:

  1. create a new file
  2. add a judge URL
  3. click the "home" button
  4. create a new file

The second new file will have the same judge settings as the first new file (until you reload the page).

stdio [read-only]

Is it possible to make the stdio section editable as altering the output is an old habit of mine.

Can't log in with gmail id

I tried to log in using my gmail account. But every time site was failed to log in. It was just loading my gmail account name after pop up of a new window. Then I selected my account and site show that loading and back to previous page. It did not logged in.

Enable Bracket Pair Colorization

It is a very important feature especially for the competitive programmer to have bracket pair colorized, as we use a lot of Nested loops, if-else statements.

USACO Problem URLs

  • Validate URL (before submit is pressed?)
  • allow pasting of the just the ID (1137)
  • Display the name of the problem somewhere, as well as the input / output format.

Screen Shot 2021-06-20 at 9 41 37 AM

shorter URLs for easier sharing

As mentioned in #7.

Perhaps 6 chars? Though probably the only use case is when I have two devices and I can't directly copy and paste between them.

Only allow one language per file?

Instead of having three tabs, we can also just only allow one language per file. It seems like this would simplify a bit of code + simplify the UI, and I can't really think of that many use cases where someone would want multiple languages in one file?

Output in new workspace

Whenever I create a new workspace , the output of the previous workspace is getting copied. The input is getting cleared but the output is getting copied.

Thanks

Creating Extra Files

Pressing "Create New File" creates a bunch of new files. The result after I clicked it three times:

Screen Shot 2021-06-26 at 10 34 35 AM

maybe it has to do w/ the permission change? @thecodingwizard

files won't load

All of my files (old files and newly created ones) won't load. The section where the files are meant to be shown displays "Loading files..." and refuses to load despite multiple page refreshes and logging into the account using a different device.
Screen Shot 2022-06-25 at 10 01 53 PM

Vim mode doesn't work

When switching from the "Normal" editor mode to the "Vim" editor mode in the "User" tab of Settings, the mode doesn't actually change to Vim; rather, it continues operating like it's in Normal mode. The following message shows up in console when the mode is changed to Vim and "Save" is pressed:

image

Additionally, if you try to go back to Normal mode after you're in Vim mode, the IDE crashes:

image

Also, this bug seems to only have appeared about a few days ago, as Vim mode was working fine before then.

Language Server Protocol Support

Immediate tasks:

  • add monaco-languageclient
  • add clangd-12
  • Java
  • Python

Future:

  • improve LSP server code (prevent it from dying due to lack of memory)
  • implement code bundling in a way that lets monaco be cached
  • Add compile flags to LSP
  • Improve connection UI (probably a status indicator rather than toasts)
  • Add ability to disable LSP
  • Add timeout to LSP to auto-stop LSP
  • e2e tests for LSP

References: https://github.com/TypeFox/monaco-languageclient and https://github.com/radian-software/riju

Submit button not working

When I press the button to submit my code to USACO, the loading wheel just keeps on looping. Looking through the console, it seems like the IP you send the code to has an expired certificate, which is then blocked by the browser.

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.