hobovsky / katasniplib Goto Github PK
View Code? Open in Web Editor NEWUserscript with a sketch of a library of code snippets useful when creating Codewars kata
Userscript with a sketch of a library of code snippets useful when creating Codewars kata
Currently, the script dos not recognize description editors in kumite and does not show the {...}
button for them.
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.
(currently automatically inherited from polyglot)
A button to be shown on each snippet code block
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:
"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
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...).
Title: Sample tests suite
Languages: Swift
Summary: A suite of sample tests with a couple of test cases.
```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)
])
```
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.
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!
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.
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.
Make it possible to mark snippets as related to other snippets.
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.
Design and implement a way to insert snippets in a quick and efficient way, for example with a keyboard shortcut.
Title: Submission tests
Languages: Swift
Summary: Example suite of submission tests for Swift
Tags: test suite
```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)
])
```
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: ?
```python
import sys
sys.set_int_max_str_digits(0)
```
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/...
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:
Configure GitHub checks to validate the snippet library JSON if changed by a PR.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.