Skip to content

Commit

Permalink
clean demo code
Browse files Browse the repository at this point in the history
  • Loading branch information
aberba committed Jul 25, 2020
1 parent cdc49e9 commit 6b361f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ void main()
// stop running setInterval()
stopInterval(tid);
stopInterval(tid2);
// OR keep running timers
// using import core.thread.osthread: thread_joinAll;
// thread_joinAll();
}
```
## Collections
Expand Down
31 changes: 11 additions & 20 deletions source/nyinaa/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
Nyinaa (meaning "all" or "everything" in Twi language) is an all-in-one collection of reusable functions & utilities (timers, validators, sanitizers, ranges, logging, ...)
Its goal is to provide convenience function commonly used when developing applications such a web development, desktop application and the like. Many functions are not implemented yet. If you want something that is not already available, please submit a pull request OR file an issue at https://github.com/aberba/nyinaa/issues
<h3> These are the categories of utilities currently being implemented.</h3>
<ul>
<li><a href="sanitizers.html">Sanitizers</a> - for sanitizing data `stripTags()`, ...</li>
<li><a href="validators.html">Validators</a> - for user data (e.g. form data) validation. `isEmail`, `isIp`, ...</li>
<li><a href="timers.html">Timers</a> - Timer function. `setInterval()`, ...</li>
</ul>
+/

module nyinaa;
Expand All @@ -22,25 +14,24 @@ public import nyinaa.validators;
unittest
{
import nyinaa : setInterval;
import std.stdio : writeln, readf;
import std.stdio : writeln;
import std.datetime : seconds;
import core.thread.osthread : Thread, thread_joinAll;
import core.thread.osthread : Thread;

void main()
{
// string name = to!string(2);

// "tid" of type Tid can be referenced
// "tid" of type Tid can be referenced
// to stop setInterval()
auto tid = setInterval(1.seconds, () { writeln("tick"); });
auto tid2 = setInterval(2.seconds, () { writeln("tock"); });
auto tid = setInterval(1000, { writeln("tick"); });
auto tid2 = setInterval(3000, { writeln("tock"); });
Thread.sleep(12.seconds);

// stop running setInterval()
// stopInterval(tid);
// stopInterval(tid2);
thread_joinAll();
stopInterval(tid);
stopInterval(tid2);

// use evenNumbers()
// evenNumbers([1, 2, 3, 4, 5, 6]);
// OR keep running timers
// using import core.thread.osthread: thread_joinAll;
// thread_joinAll();
}
}

0 comments on commit 6b361f9

Please sign in to comment.