npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

playground-plugin-challenges

v0.0.11

Published

Turn Your Gists into Interactive Coding Challenges in the TypeScript Playground.

Downloads

23

Readme

playground-plugin-challenges

Turn Your Gists into Interactive Coding Challenges in the TypeScript Playground.

Try it Out

Created with the typescript-playground-plugin-react template.

How To Create Your Own Challenges

Sign in to GitHub and go to https://gist.github.com/YOUR_USER_NAME.

Click the + icon in the upper right hand corner to create a new Gist.

The Gist Description will be the name of your challenge project.

From here, you will create a markdown file (.md) for each challenge item that you would like to create. The name of the file does not matter other than the .md extension. The order of the challenge items will be based on the order of the markdown files.

Each markdown file should consist of three parts:

  1. Front Matter (optional metadata)
  2. Starting Code Block (problem code)
  3. Ending Code Block (solution code)

Front Matter

Front matter is metadata that you can provide to each challenge item to change the UI or behavior.

The options are as follows:

| Name | Description| |--|--| |title |The title of the challenge item. Defaults to Challenge #1. | |description|A description of the challenge item displayed below the title.| |hint|If you provide a hint, a button will be displayed that allows the user to reveal the hint.| |exclude|A list of TypeScript types that the user is not allowed to use. |

Example

---
title: Add Function
description: A simple function that adds two numbers.
hint: Think math.
exclude: string any
---

Starting Code

Next, you will supply the starting code by using a code block (triple backticks).

This code should be written like JavaScript and not contain any TypeScript annotations.

It will be the user's job to add the necessary TypeScript code to make the errors go away.

Example

```
function add(a,b) {
  return a + b;
}
```

Ending Code

This represents the corrected version of the starting code and should not result in any errors.

The user will be presented with a Show Solution button. Once clicked, the editor code will be replaced with the ending code, which should cause all errors to be resolved.

Errors can result from one of three things:

  1. TypeScript compile errors
  2. Errors resulting from using types in the excluded list defined in the front matter.
  3. Any changes that deviate from the starting code.

If this ending code results in errors, the user won't be able to progress to the next question. It is recommended to double check your code each time with the plugin to ensure that there aren't errors in the ending code.

Example

```
function add(a: number,b: number) {
  return a + b;
}
```

Full Example

---
title: Add Function
description: A simple function that adds two numbers.
hint: Think math.
exclude: string any
---

```
function add(a,b) {
  return a + b;
}
```

```
function add(a: number,b: number) {
  return a + b;
}
```

Just Remember

  • It's one Gist per Challenge group and one markdown file per challenge item.
  • Each markdown file consists of 3 parts: front matter, starting code block, and ending code block.
  • Front matter is optional. The starting and ending code blocks are not.
  • The ending code is only used to show the user one possible solution. Their code is checked against the compiler errors and compiled source code. This means that their solution does not have to match your solution. It just has to pass the compiler check, front matter exclusion types, and match the original source once compiled.