GithubHelp home page GithubHelp logo

katasniplib's People

Contributors

hobovsky avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

captain-quack

katasniplib's Issues

UX - buttons: copy at & copy to clipboard

Request:
currently, there are a lot of clicks to do on user's side. For 2 lines snippets, this means there are no storng advantage to go through the snippets provider rather than just type the code. Here are some ideas to make the snippets provider quicker to use.

Copy to clipboard button

(currently automatically inherited from polyglot)

A button to be shown on each snippet code block

"Paste at cursor position" button

A second button, on each code block, that would paste the snippet directly at the current cursor position in the "parent" editor.
Things to consider:

  • add in the current line? (meaning, possibly right in the middle of the current instruction)
  • replace current line?
  • insert the snippet before or after current line
  • change the behavior if a selection exists? (=> replace the content with the snippet, in that case?)

"insert before current line" would have my preference, I believe (without selection).

Note: the context menu I was talking about in #14 could be of use to provide different options there. Especially, insert before vs replace

"Paste at cursor position" on double click

Same as above, but triggering it with a double click on the snippet code block. Most likely more useful than button ('cause, quicker), but the button still would be nice, to showcase the functionality (sort of...).

Sample test suite for Swift

Title: Sample tests suite

Languages: Swift

Summary: A suite of sample tests with a couple of test cases.

Kata snippets:

  • submission tests
  • example tests
  • complete solution
  • solution setup
  • preloaded code
  • description

Markdown

```swift
import XCTest
// XCTest Spec Example:
// TODO: replace with your own tests (TDD), these are just how-to examples to get you started

class SampleTest: XCTestCase {
  
    static var sampleTests = [
        ("Tests for even numbers",   testEven),
        ("Tests for odd numbers" ,   testOdd )
    ]

    func testEven() {
        XCTAssertEqual(solution(n:  2), "Even")
        XCTAssertEqual(solution(n: -6), "Even")
    }
    
    func testOdd() {
        XCTAssertEqual(solution(n:  1), "Odd")
        XCTAssertEqual(solution(n: -7), "Odd")
    }
}

XCTMain([
    testCase(SampleTest.sampleTests)
])
```

Custom assertion messages for Nim

There seems to be no easy way to provide failure messages to Nim tests. There is no explicit assertion functions, and the check macro does not seem to accept any parameters which would result in an additional, custom message.

Cpp_Example_Test_Snippet

Request:
Currently there's no Example test suite snippet from which users could grasp the general idea of writing own tests. Providing such snippet would be a great launching point. I do not suggest to explicitly copy the one from documentation, rather short prototype (variation) with some basic implementation details and explanations to them: headers,namespaces,function declarations. Either divide the snippet to sub-groups according to specific topic, and attached link to documentation. Thanks!

Introduce private snippets

Is your feature request related to a problem? Please describe.

Sometimes, users might want to create a snippet for their personal use and not have it published in the library.
Such feature can be useful for example for favorite pieces of code used commonly while solving kata (in the "Complete solution" editor).

Describe the solution you'd like

The private snippets would be stored client side, outside of the public library. The script would provide UI to manage (add and remove) such snippets.

Introduce snippet groups which are a translation of an idea into multiple languages

Is your feature request related to a problem? Please describe.
Sometimes, a group of snippets in different languages can describe exactly the same, translatable pattern. However, managing consistency between members of such groups can be difficult, because with current setup it's difficult to track such snippets. Improvements to a snippet can be difficult to distribute between all snippets describing the same pattern.

Describe the solution you'd like
Introduce new entity: a group of snippets which represents a precisely defined pattern and collects translations which are as consistent as possible in the group.

Describe format of the library document

Users who would like to extend the library might need to know the format of the library file. The format of the document should be documented.

Idea: use JSON schema.

Submission tests suite for Swift

Title: Submission tests

Languages: Swift

Summary: Example suite of submission tests for Swift

Tags: test suite

Kata snippets:

  • submission tests
  • example tests
  • complete solution
  • solution setup
  • preloaded code
  • description

Markdown

```swift
import XCTest

class FixedTests: XCTestCase {
  
  static var fixedTests = [
    ("Examples",                         testExamples           ),  
    ("Tests for one type of inputs",     testSomeTypeOfInputs   ),
    ("Tests for another type of inputs", testAnotherTypeOfInputs),
    ("Tests for edge cases" ,            testEdgeCases          )
  ]

  func testExamples() {
    // Examples from description
    VerifySolution(1, "Odd" )
    // ...
  }

  func testSomeTypeOfInputs() {
    VerifySolution(2, "Even")
    // ...
  }

  func testAnotherTypeOfInputs() {
    VerifySolution(7, "Odd")
    // ...
  }
  
  func testEdgeCases() {
    VerifySolution(0, "Even")
    // ...
  }
}

class RandomTests: XCTestCase {

  static var randomTests = [
    ("Random tests", testRandom)
  ]  
  
  func testRandom() {    
    let randomCases = ...             // generate random inputs
    for randomCase in randomCases {
      let input    = ...              // input of the test case
      let expected = ...              // expected answer for this test case
      VerifySolution(input, expected)
    }
  }
}

func VerifySolution(_ input: Int, _ expected: String) {
  let actual = solution(n: input)
  XCTAssertEqual(actual, expected, "Incorrect answer for n=\(input)")
}

XCTMain([
  testCase( FixedTests.fixedTests),
  testCase(RandomTests.randomTests)
])
```

python tests: set_int_max_str_digits

Title: set_int_max_str_digits

Languages: python

Summary: Allow conversion of huge int values to strings in tests feedback (update to 3.11)

Tags: ?

Kata snippets:

  • submission tests
  • example tests
  • complete solution
  • solution setup
  • preloaded code
  • description

Markdown

```python
import sys
sys.set_int_max_str_digits(0)
```

Q: data organization (long term)

in content/snippets, all snippets aren't really discoverable. That's not a problem for now, but once their number grows, it might become very hard to find "the snippet you wanna update or check against a new idea that already exists".

Also, the organization is totally opaque for now. It seems that poly_0001 is storing initial solutions in various languages?

Suggestion:

Use human friendly slugs? possibly adding an automatic ID at the end to enforce uniqueness?

Example:

    snippets/init_sol_0001/python_0001
                          /python_0002
                          /kotlin_0003 (or 001?)
            /random_tests_0002/...

Introduce tags

Amount of snippets can grow large, snippets can relate to different areas, and the list of snippets can easily get very bloated. Maybe tags would be a good way to make browsing experience better.

Questions:

  • UI for filtering by tags
  • Management of tags

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.