Skip to content

Instantly share code, notes, and snippets.

View cngeru's full-sized avatar
👨‍💻
Coding

Dennis Chege cngeru

👨‍💻
Coding
View GitHub Profile
void main() {
var users = ["a","b","c"];
var tasks = 10;
print(roundRobin(users,tasks));
}
Map<N, List<T>> roundRobin<N, T>(List<N> names, int taskCount, T createTask(int number)) {
var tasks = [for (var i = 0; i < names.length; i++) <T>[]];
for (var i = 0, j = 0; i < taskCount; i++) {
@cngeru
cngeru / sundaysInMonth.js
Last active January 14, 2021 04:45
Get all sundays a month or get "specific day of week" in a month using dayjs (In the future)
func getSundays {
let startTime = 1234294232 // unix timestamp of a day in paricular
const startTimeObj = dayjs.unix(startTime)
const startOfDay = dayjs().startOf('day',startTimeObj)
const endOfMonth = dayjs().endOf('month',startTimeObj)
const days = []
let pastEndMonth = false
let newDay = startOfDay.add(7, 'days')
do {
<canvas id="surface" width="600" height="400"></canvas>