1

The week selector is based on ISO8601, and Monday was decided as the first day of the week.

You would need to use a custom widget to customise that. Alternatively, use two inputs, one with the year and one with numbers 1-52. But where possible, I try to stick to standards.

Templating is definitely the way to go for dynamic sections, don't try to build HTML manually with jury or similar. Simplicity is key.

Votes + Comments
OK, I'm gonna figure this out and post back here when I have it officially solved. Thx a ton!
1

but how can I add HTML instead of the 1-word you used for each day?

Yes, you can add whatever you like. If you structure your data something like this, you can easily use a simple templating library to insert any HTML you like

    let data = {
        "2018-W12": {
            "Monday": {
                exercise: "Squats",
                reps: 50,
                intensity: "medium",
            },
            "Tuesday": {
                exercise: "Pressups",
                reps: 30,
                intensity: "hard",
            }

        }      
    };

Also noticed the 2018 references in the javascript

I did this for speed. You could write it by hand, or easily programatically generate a schedule for the next several years, or you could write some code that generates them on the fly. Without knowing your plans for creating the exercise schedule it's difficult to say, but providing your data is well-structured it's not that difficult.

Votes + Comments
Wow, I've never even seen that templating thing before. I'm gonna play with that a ton. Thx!
2

Perhaps I didn't fully understand what you're after, but I'd steer clear of using plugins when you can use standard inputs.

Here's a five minute stab at what I think you're asking for. If it's not it should be easy to customise. Where I've defined let data = {...} you should be reading that from your data (or API) and not hardcoding it in the function!

Oh, and I've only added data for W12 2018 and W13 2018 so it'll throw errors for other weeks. You'd have to revert to a default schedule or handle the error sensibly.

Votes + Comments
That's very close, but how can I add HTML instead of the 1-word you used for each day? Also wondering how I can get the week to start on Sunday . Thx
pretty nifty
1

Working out the difference between two files is trivial using (like I said earlier) diff and comm, both of which have existed since at least the 1970s.

The two provided files, diffed by word. Red bits have been removed, green added.

Screen_Shot_2018-02-15_at_16_18_03.png

Now, comm outputs three columns

  1. lines only in file 1
  2. lines only in file 2
  3. lines in both files

So by default, lines that were deleted in file 2 will be in column 1, lines that were added in file 2 will be in column 2, and lines that remain unchanged will be in column 3. You can surpress columns using -1, -2 or -3, so we can run the command multiple times to get a nice summary.

Lines deleted in f2:
deleted.png

Lines added in f2:
added.png

Lines unchanged:
unchanged.png

0

No, that's how you're currently trying to do it. It being something confusing.

What is the outcome? Simple, a couple of sentences max. For example:

I'm trying to implement some kind of custom phone number validation where numbers follow [this pattern]

or

I'm trying to record someone's phone number without them actually submitting the form

By using words out of context and nonsensical phrases like "assign it to a session" confuses matters to the point where I can't tell what you're actually attempting to write.

0

Not that it matters, but here it is in Ruby.

Simple, elegant and concise. Dare I say, beautiful?

lower, upper = 20, 400

lower.upto(upper)
    .select{|i| i.modulo(3).zero? && i.modulo(4).zero?}
    .each_slice(5){|m| puts m.join("  ")}

.upto loops from the called number to the arg. Normally I'd have written this (lower..upper).select… but this makes it a bit clearer.

.select returns an array containing elements where the block returns true.

.each_slice iterates through the enumerable object in chunks (the first arg, 5 in this case) and executes the block for each chunk (printing the array joined by two spaces).

1

Keeping questions and scenarios fresh helps prevent lesser students (like this one) from just finding the answers online.

This problem has been solved hundreds of times, and there's an exact duplicate in this forum.

I don't mind helping but I like to see some effort first, not just pasting the question directly into a forum. If you want to help the OP do his homework without actually learning anything, go ahead.

0

This problem was solved like 40 years ago.

$ sort -t" " -rnk4 data.tsv
ascon1 201707015 Jack 97.5 11.5 11.5 11.5
ascon1 201707013 Josh 79.5 11.5 11.5 11.5
ascon1 201707011 John 77.5 11.5 11.5 11.5
ascon1 201707012 Grld 70.0 11.5 11.5 11.5
ascon1 201707014 Jess 67.5 11.5 11.5 11.5
  • -t" " to tell sort to split on spaces
  • -r for reverse (highest first)
  • -n to tell sort that it's a numeric field
  • -k4 to tell sort that we're loking at the fourth column