This is a Chrome Extension adding features that make the user experience on DataCamp even better.
A copy to clipboard
button is added to the currently visited subsite of any DataCamp course. It allows you to get the relevant content of the page, formatted as markdown that you may copy into R Studio directly. This can be useful for creating documents summarizing what you have learnt. Several sub-sites are supported. Lists, code blocks, inline code, or even LaTeX are pre-formatted accordingly as well.
The exercise description + instructions are copied. Use the include code output?
checkbox to control whether the code should be copied as executable R markdown code blocks, or as code blocks with EVAL = FALSE
with the output from the R session in DataCamp copied instead. Hitting the copy
button also submits the code per default. The script then tries to submit all sub-exercises at once (if there are any) and copy the results together into nicely formatted markdown. See an example of the behavior below:
You can tweak many aspects of the code copying behavior. Because of time constraints this is not yet configurable via UI, but only by changing the codeExerciseConfig
in src/feature-modules/copy-helper/index.js
.
The course description + all chapter descriptions are copied. Furthermore, a YAML header with sensible defaults for creating PDF output from the R markdown document is generated:
The contents of all the slides are copied (including formatted code, tables, lists etc.):
Unfortunately, images cannot be copied in the same step. You may however use the slide image viewer to view the images and copy them separately.
Two types of drag-drop exercises are supported:
- Drag-into-correct-bucket-exercises:
- Drag-into-order-exercises:
No more tedious typing of the same variable/function names across several exercises: just paste them into the editor by clicking on them in the exercise description!
This script adds several kinds of (more or less) useful keyboard shortcuts.
One can use the following shortcuts in the code editor (which are probably known to R Studio users):
Key combination | Output |
---|---|
Alt + - | <- |
Alt + . | %>% |
Alt + i | %in% |
This extension fixes many of DataCamp's built-in shortcuts. They don't work well out of the box as they clash with default browser key combinations and apparently this was not handled appropriately by the devs of the DataCamp web app.
Navigate through exercises with Ctrl + J and Ctrl + K:
The experience with video pages is improved as well (Ctrl + J, Ctrl + K, and Ctrl + O also work while the video is focused).
Focus into videos on the video page by pressing F, leave focus with ESC.
You can also use Alt + E to focus into the code editor at any time while on a code exercise page.
Use Ctrl + Shift + J and Ctrl + Shift + K to cycle through sub-exercises of a code exercise:
Toggle the course overview modal (open with Ctrl + O, close by hitting ESC):
In every demonstration video, you may skip through the slides used in the video, either with the buttons, or using Ctrl + Shift + J and Ctrl + Shift + K. The video is then automatically forwarded to the timestamps where the slides appear:
Furthermore, you may choose to view only the slides (without the video). You can then also copy the slide content (text, code, and also images) as you wish!
As this Chrome Extension has not been published in the Chrome Store, you need to clone its repo (or download the code) and install it in developer mode.
Instructions:
- Get the code (by cloning this repo or downloading and unzipping)
- Go to
chrome://extensions
- Make sure Developer mode is on (switch in the upper-right corner)
- Click on
Load unpacked
- Choose folder containing code
I created this extension solely for the purpose of reducing time spent with dumb copy-pasting in a course of the Data Science Master's degree at TU Wien. There, we had an extremely lazy lecturer who basically just gave us a list of DataCamp courses that we should take. For each of those courses, we were tasked with creating a R Markdown file, were we essentially just had to copy all the stuff we did and explain what the code does. (btw, I'm aware that implementing this solution was probably 10x as much work as doing the stupid manual copy-pasting work, but at least I had fun haha)
Over the course of the semester, I kept on working on this "copy-helper script", and added additional features I considered useful.
I used this project to explore things one can do with vanilla JavaScript. Initially, this project was a single huuuuge TamperMonkey user script. Later I converted it into a Chrome extension, trying to make use of the native ES6 module system instead of relying on Webpack or other build tools. This was still kind of a pain, so probably for my next project I will use TypeScript and other more convenient alternatives, including React or some other frontend framework.