mirror of
https://github.com/hsjobeki/noogle.git
synced 2024-12-25 23:13:30 +03:00
Website: Show random empty function
This commit is contained in:
parent
069604f203
commit
5bdcec2bc8
@ -10,7 +10,6 @@ associated code.
|
||||
These comments serve as a source of reference documentation for noogle,
|
||||
offering valuable information about the purpose, functionality, and usage of the code elements they document.
|
||||
|
||||
|
||||
## Placement
|
||||
|
||||
Please place your doc-comments as shown below.
|
||||
@ -28,19 +27,4 @@ In any case you can place the documentation directly before the lamba. (only whi
|
||||
x: x;
|
||||
```
|
||||
|
||||
> **Advice**
|
||||
>
|
||||
> Open up the file in your editor and go to the exact `line` `column` marker that noogle gave you.
|
||||
|
||||
## Checklist for writing good documentation
|
||||
|
||||
- [ ] Describe what the function does.
|
||||
- [ ] Provide examples for different scenarios when this function might be useful. -> ` # Example(s) `
|
||||
- [ ] Provide a (single) type signature -> `# Type `
|
||||
- [ ] What types does the function expect?
|
||||
- [ ] Try to use this [typing convention](/md/typing) for best compatibility with noogle
|
||||
- [ ] Describe the purpose of all arguments.-> `# Arguments`
|
||||
- [ ] Positional Arguments
|
||||
- [ ] All known Attributes
|
||||
- [ ] Maybe describe edge cases or what else should be taken into account
|
||||
- [ ] References to other functions
|
||||
**For contributing to [nixpkgs]() check their documentation [contributing guide](https://github.com/NixOS/nixpkgs/blob/master/doc/README.md)**
|
||||
|
@ -14,7 +14,10 @@ import { Preview } from "../preview/preview";
|
||||
import { Doc, data as raw } from "@/models/data";
|
||||
|
||||
// Show only functions with content.
|
||||
const data = raw.filter((d) => d.content?.content);
|
||||
const data = raw;
|
||||
const emptyIdxs = raw
|
||||
.map((d, idx) => (d.content?.content ? false : idx))
|
||||
.filter(Boolean);
|
||||
|
||||
const date = new Date();
|
||||
|
||||
@ -77,7 +80,11 @@ export const FunctionOfTheDay = () => {
|
||||
};
|
||||
|
||||
const setRandom = () => {
|
||||
setIdx(getRandomIntInclusive(0, data.length - 1, { init: Math.random() }));
|
||||
const random = getRandomIntInclusive(0, emptyIdxs.length - 1, {
|
||||
init: Math.random(),
|
||||
});
|
||||
|
||||
setIdx(emptyIdxs[random]);
|
||||
};
|
||||
const setFunctionOfTheDay = () => {
|
||||
setIdx(todaysIdx);
|
||||
@ -112,7 +119,7 @@ export const FunctionOfTheDay = () => {
|
||||
</Button>
|
||||
<Divider flexItem orientation="vertical" />
|
||||
<Button sx={{ width: "100%" }} onClick={() => setRandom()}>
|
||||
Random
|
||||
Random Undocumented
|
||||
</Button>
|
||||
<Button sx={{ width: "100%" }} onClick={() => setFunctionOfTheDay()}>
|
||||
Todays function
|
||||
|
Loading…
Reference in New Issue
Block a user