« first day (351 days earlier)      last day (1088 days later) » 

12:12 AM
@Spectric It works! :)
I think perhaps my "Rework of the Suggested Edits review queue UI" user script is ready :)
Hmm.. except, I don't have an API key yet.
 
12:42 AM
I'm not sure I understand how to get an API key. At Throttles / Rate Limiting they both mention "valid access_tokens (obtained via authenticating a user)" and "This quota is based on the key being passed by the applications". So what is the difference between a "key" and an "access token"?
 
@Scratte I actually took a look into that some time ago. You have to register it here: stackapps.com/apps/oauth/register
 
Both the Authentication and the JavaScript SDK seems to discuss user authentication, which I'm not interested in. I'm not looking to authenticate any users.
@Spectric I see, that is also linked from the Authentication page. It's a little confusing though, since I had the impression that was for scripts that requires users login with the script.
 
@Scratte Is there no special font? It was supposed to be in Roboto.
 
So, I can use my regular email login on the link?
@Spectric The font you used doesn't look like regular Stack font :)
And when I zoom in I can see that it is in fact not the font used on Stack. The g's are an obvious giveaway :)
 
Stack uses Arial. It appears that you're seeing Times New Roman.
 
12:53 AM
@Spectric I'm no expert in fonts. Nor in my browser defaults.. it could easily be that my system doesn't have it.. I'm guessing here.
 
3
Q: Stack Focus v2.2

Spectric Screenshot / Code Snippet About Personalize your Stack Exchange experience. Inspired from this question. It provides you to ability to toggle the visibility of certain elements on the page, including: The "Find a Job" category on the left sidebar The Teams advertisement on the left sidebar...

I cannot stand that Times New Roman font...
 
@Spectric I quite like it :) But here is your script with a new font :)
 
Yep. You like the new font?
 
1:08 AM
It kind of looks like Stack's font :)
LOL // @description Cool stuff
 
Yep :) I never bothered to change it
 
That's fine. At least you didn't leave // Your code here... and // @namespace http://tampermonkey.net/ :)
I'm not sure if I should leave it or change @description Make reviewing nice again!
 
@Scratte You scared me for a second there
 
Heh.. That's wasn't my intention
 
1:24 AM
No harm done :)
 
Do you know if there are any rules that says that two different scrips can't use the same API key?
 
I was under the impression that the token is only for fixed domains, rather than userscripts.
 
Huh? Fixed domains? As in "reviews" or "profiles"..
On a side note, I think it's funny that Stack Apps is an exception on the network where users can post an Answer in the Question box.. without asking a question :)
@Spectric "API authentication channelUrl from a userscript?"
 
I was referencing to this sentence: "SE's Javascript SDK assumes that you have your own domain and that everything is same-domain. The SDK has code like:"
But nevermind, I realized that it is possible to use the API for userscripts
 
Yes, that post seems to be about user authentication too.
 
1:34 AM
I'm sort of confused how the API is supposed to be used for libraries
If it's being referenced all across the internet, how are you supposed to fill in the "Application Website" field?
 
I have no idea how that works..
This is all related to OAuth, which is not what our scripts will need or want.
This is part of the code in the Answer var reqURL = apiBaseURL + /inbox?filter=!6LdGvjJhl2HHw&key=${apikey}&access_token=${accessToken};
This is what is needed to get the 10K requests per day: &key=${apikey}
This is what is needed to be able to use the script to do user stuff, like voting or editing: &access_token=${accessToken} (I expect some bots need that one :-)
There's also an Answer to Getting “application not configured for implicit grants” error trying to setup website with screen shots about how to set it up :)
 
 
2 hours later…
4:09 AM
@Scratte a key increases your quota from 300 to 10000
an access token is used to make write changes/access private info, etc.
the methods that require an access token are those that have auth required next to them in api.stackexchange.com/docs
you probably don't need to get an access token to get information about a user, but you need one in order to vote on a post or get your inbox via the API
@Spectric why are you creating a new folder in GH for each new version?
 
 
2 hours later…
5:51 AM
here's my try to rewrite your script
 
 
1 hour later…
7:14 AM
@KevinM.Mansour how a forgotten bracket can create a DDoS attack? :) At best you can achieve SyntaxError. Do have a sample in mind?
@KevinM.Mansour don't use document.write: developers.google.com/web/updates/2016/08/…
@Spectric I think technically it counts even if there is only one address - depending on whether you managed to achieve the goal of denial of service
@Spectric hm, the redesign looks nice :)
@Spectric but, as usual, claims are doubtsome. I wish they just made a tile layout and did not highlight HTML, JS, Python and SQL that much
@Scratte methods of authentication. API key is a very crude means of authentication (shove it in a URL as a query parameter, and you are done). While access tokens is the result of authenticating via OAuth protocol (2.0 nowadays)
@Scratte it is a usual practice - you register an OAuth application and obtain a client id and secret. Your users authorize the app and get a token back which is then sent with every API request in the Authorization header. It is a good way to establish trust - if your user misuses their token, it can simply be revoked, otherwise, they can enjoy higher quotas
 
7:32 AM
@Scratte what are you working on?
 
7:43 AM
@Yatin this :)
 
@Scratte Cool ;)
 
Any favorites? border or no border?
 
No border :p
 
Good thing I made it an option then ;)
 
:)
 
7:47 AM
@OlegValter I think I assumed there'd be a difference between the keys. We just want a quota extending key, not a authorization enabling key :)
 
8:04 AM
@Scratte there is a difference, I think @double-beep explained it pretty well :) But if you do not intend to allow access to private info - is there a reason to add OAuth?
 
@OlegValter No :) I just assumed that there would be two separate ways to obtains an API key, that's all :)
How is your script coming, btw? :)
 
@Scratte what do you mean? :) I work on it from time to time, but have no intention to rush
 
@OlegValter Just curious about how it's going :) I'm not asking for an ETA :)
Do you want to share a an API key?
 
@Scratte ?
 
I assume we are both using the test key right now :)
 
8:34 AM
@double-beep Thank you for explaining that. It is what I expected :) As I also told Oleg, I've been confused about getting one :)
 
you should register your app
but in order to do that you need to register on StackApps
and iirc you don't like creating accounts on other SE sites
 
That is correct :D But I think I have a profile on Stack Apps already.
I can't remember the username I have there though. Probably something irrelevant.
But since Oleg and I are making the same sort of App(?), I thought we could use the same key
Is a user script an App? I thought an App was more.. independent or could be installed as an extension directly.
 
a userscript is a [script]
 
Here we go, I found me. I'm currently Useless
@double-beep I didn't log in. Is this something it will ask me if I try to register for a key?
 
yep
 
8:47 AM
My script isn't really ready yet. I think it needs to be tested first :)
 
you don't need to post on StackApps about your script
(in order to acquire an API key)
 
I didn't expect that I had to :) That would be a little of a strange requirement :)
I expect though that there's noway to hide the key. It would always be in plain test in the script. So how does any script writer ensure that their app-key isn't "abused"? I mean used by other scripts? (Either by the same script-writer or not)
 
the key is public
and the quota is per IP
so I'm not sure what you mean "abused"
 
Example: I go and find another script. I take that key and use it in my script.
 
@Scratte you only need to post on StackApps to get an access token with write_access scope
@Scratte so what?
 
8:52 AM
Heh.. but then why register for one, if it doesn't make a difference? (on a non-write-access script, that is)
 
it shouldn't make a difference indeed
it's up to you
 
I see :) Is posting a user script (that uses the test key) on Stack Apps frowned upon?
 
Heh.. I wonder if it turns up a lot if I search for it :D
 
9:06 AM
Hmm.. I think there's a bug in my script :D
 
@Scratte API keys are not meant to be secure :) This is why OAuth flow is used for enabling access to sensitive actions/data. The only way to keep the key secure is to add an authentication layer for your script and only give out the key to authorized requests made to the domain you control. But that's unnecessary since it does not add anything useful on top of the OAuth flow unless you intend to have user accounts with preferences and such
@Scratte hm?
@Scratte I... don't understand :) I don't use any test keys - the requests are made without any credentials
@Scratte ??
@Scratte yes, I think your terminology is correct. An "application" is a set of scripts that can be used on its own. So what we both have are not applications, but scripts.
@double-beep ok, seems like I am late to the party :)
 
9:26 AM
@OlegValter I'm not checking to see if the review is done or not. So right now I'm still showing all the buttons, even if the review is over.
 
> This is not considered a secret, and may be safely embed in client side code or distributed binaries.
(about the API key, on StackApps)
 
@OlegValter I see. I added this bit to the code I stole borrowed from you:
        const getSuggestionsUserStats = async (id, options = {}) => {
            const url = new URL(`${API_BASE}/${API_VER}/users/${id}/suggested-edits`);
            const params = {
                site: options.site || "stackoverflow",
                key: options.key || 'U4DMV*8nvpm3EOpvf69Rxw((',  // this bit :)
            };
 
hmmm...
> In versions of Legacy Edge 18 and below, we're at 15,230 users over the last 7 days. Edge represents 6.13% of all our users, with 1.02% of that amount using 18 or below.
> For full context, We have 23,333 Internet Explorer users, a browser we don't support at all. Legacy Edge is a smaller user share than that.
(SE statistics)
 
Do you have a link for that?
 
9:30 AM
@Scratte ah, I see :) Well, I am not sure if this even counts as a bug, more like "status-planned"
 
"23,333 Internet Explorer users" <-- someone did not upgrade their system :)
@OlegValter I count it as a bug :)
 
@Scratte I don't think it even counts as borrowed :) Too small of a sample
I think I need to abstract full URL generation
 
@OlegValter I took the entire constant :) Not just the first few lines :)
@OlegValter I don't think you do, because the script is set to only work on suggested edtis, no? :)
 
@Scratte under the current SE design policy of "show everything regardless of whether user can or cannot do the action" it might be even considered a feature :)
@Scratte ? I mean this: ${API_BASE}/${API_VER}/users/${id}/suggested-edits
 
@OlegValter Yes. Do you want to abstract out the users and suggested-edits too?
How does one call the getSuggestionsUserStats with the options set? With a json? Like your config const?
Or maybe I'm confusing myself. The const config looks more like a multilevel array to me
Thought I'm not sure what the naming is. Normally arrays to me do not have key/value pairs
I'm referring to this:
const config = {
        classes: {
            grid: {
                container: "grid",
                cell: "grid--cell",
            },
        },
        ...snip...
};
 
9:48 AM
@Scratte it's just an object :) Every property in JS can be anything else: an object, an exotic object, or any primitive
@Scratte it's not json, just a plain object (but you can pass in anything else that is an object, for example, an instance of a class having the properties expected by the function [or not having if you want a runtime error to happen :)])
getSuggestionsUserStats("1234", { site : "example.com" })
@Scratte JS does not have the notion of associative arrays :)
 
So getSuggestionsUserStats("1234", { site : "example.com", key: "thisKeyNotWork" }) will do too? :)
How about getSuggestionsUserStats("1234", config.classes)?
 
@Scratte of course :)
 
On a sidenote. The pastebin.com site does not have a license to uploaded material by default, so any code of your that I took from the pastebin is under an exclusive copyright by default. Meaning I need explicit permission from you to use it and post it under another license, like CC-BY-SA.
 
@Scratte yes, if confi.classes has the site and key properties :) Well, it will work even without that, but the result depends on whether or not you specified default parameters or guard against such things happening
 
@OlegValter In the code you provided, you do guard against it :) I'll need to add another fixme to my project :D
Though you do not guard against any provided values being valid values ;)
 
10:00 AM
@Scratte yup, I do, the if (Object.keys(options).length) statement - although I think this wasn't the best thing to do - shouldn't have added defaulting to empty object and just check for truthiness
 
getSuggestionsUserStats("1234", { site : "exam@ple", key: "thisKeyNotWork" }) is probably going to make something else fail ;) But I think of such things as features :)
I added this to mine (inspired by you of course):
const userConfig = {
        colour: {
            postType: "var(--red)",            // "var(--blue-500)",
            summary: "var(--orange)",
        },
        size: {
            editorStatistics: "96%",
            summary: "150%",
        },
...
I think that if someone puts "abc" instead of a valid value for size, then it's not really up to the program to fix it and run anyway.
 
@Scratte unless you really need a self-correcting code, then yes, I agree :)
@Scratte what I find very nice about config objects is that they make it so easy to add user settings later on in the game - just choose the mechanism to serve/update the config and voila :)
 
@OlegValter It certainly has its uses. But sometimes it also makes it cumbersome. A method that goes somewhere else to check for the value can be a little annoying since the information is spread out. So I think it depends on context.
Not that I actually like those magic numbers
Example:
    function moveToFilterLine(element) {
        // Find parent element for the filter button and add element to it:
        var filterDiv = document.querySelector(".grid--cell.grid.ai-center.as-stretch.py16");
        if (filterDiv) {
            filterDiv.appendChild(element);
        }

        // This is the BIG radio button box:
        removeElement(".js-actions-sidebar");
    }
 
@Scratte ^ that's why the config object is usually passed around as a parameter :) if you see it just referenced inside a function in my code, it just means I was lazy this time
@Scratte that approach quickly spirals the more selectors/magic numbers you get
 
10:16 AM
@OlegValter Yes, I know. But the thing is that if the class names changes, there's a good chance that I need to revisit the logic. Not just update the list of class names.
 
^ and once SE decides they no longer want to have a grid--cell class but grid-cell, you will be running search & replace on the whole file :)
 
@OlegValter very unlikely, because they'd need to change it in their HTML/JS as well
 
@double-beep that's just a random example :)
 
@OlegValter Yes.. that is correct. For something like that, I'll be a little annoyed with myself :) But what if they just introduce a new one? And now they have two. One for one kind of grid and another for another kind of grid. Now no structuring can help you anyway :)
It's kind of like interfacing to an API and trying to guard against name changes of the methods :P
 
@Scratte how about const filterDiv = document.querySelector('#js-review-filter-id').previousElementSibling? Seems more stable
 
10:19 AM
@Scratte that's hypothetical - while forgetting to update "that little magic number in file X, subfolder Y, line Z" is a real issue :)
 
@double-beep Hmm.. I'll check that out. There's only about 500 of those spread out in the script :D
 
@OlegValter I don't think they've ever renamed a Stacks class
what's likely to break the script is the removal of one of the classes in the selector
 
Yes. I need to revisit all of that in my script. Because I just put in whatever the list was.
 
@double-beep well, they probably follow the BEM methodology, judging from the class names, so yeah, it is highly unlikely they will be changing a class name. I only referenced it because @Scratte's example was about selectors as magic strings
 
that's why I suggested using an id
 
10:24 AM
@double-beep Thanks :) I just found a lot of the time, there is no id :(
Like.. how do I know a review is over, other than checking for document.querySelector(".js-actions-sidebar.d-none");?
 
so you can use the id of another element, then use .next..., .previous..., .parentElement, etc.
@Scratte document.querySelector('.js-action-button').innerText === 'Next task'
 
@double-beep OK. But is that more stable? What if they move the elements around?
 
still... more stable than a list of the Stacks' classes
 
@Scratte btw, you can also check for the presence of aside[role=status] :)
@double-beep it is probably safe to rely on classes prefixed with js-, after all, the scripts rely on them to identify elements (although I do not really understand the idea behind not just giving those elements ids to reference)
 
The text of a button seems.. more prone to change than the d-none class, to me.
 
10:32 AM
@OlegValter yes, the js-* classes are usually unique
 
@Scratte But.. one can see the change in the userinterface and update accordingly :)
@OlegValter I did not think of that.. :)
 
@Scratte or just [role=status] - the aside tag could change, but the role doesn't usually change :) Unless, of course, the change is to introduce the id="status" instead
 
I've just realized that it will take at least a week to go through all those places where I find elements and make it more stable :'(
 
@Scratte and why is that? :)
 
@OlegValter There's a million and one places.. I'll try to find id's and use @double-beep's suggestion of ".next..., .previous..., .parentElement"
 
10:54 AM
Hehe.. there's a "<aside class="js-review-instructions d-none mb12" role="status"></aside>" on active reviews :)
 
@Scratte what?
that sucks
 
    function isReviewActive() {
        return (document.querySelector('[role=status]') ? true : false);
    }
Always returns true :)
 
I checked
it is
but it is empty
so you can check if it has children
 
Oops.
 
@Scratte btw, expression ? true : false is unnecessary, you should return !!document.querySelector('[role=status]')
 
10:57 AM
@OlegValter Thanks. :) I'll do that :)
@OlegValter I thought of that, but then I remembered something about not using the !! construction :)
 
@Scratte using true : false in ternary is worse :) Because the expression already evaluates to boolean
@Scratte 'tis ok if the public contract of the function is that it returns a boolean. After all, it is even called isReviewActive
 
I just didn't want to return document.querySelector('[role=status]'), because I want a boolean value returned, not some object.
 
!! is only unnecessary in statements that expect truthy / falsy values
@Scratte so, return !!expression :)
 
I will :) Thanks :)
..checking for children now. Searching Stack for how to do that :) I get a lot of searching done when making scripts like this.
 
@Scratte .children.length :)
@Scratte alternatively: firstElementChild (no children no first one :))
 
11:02 AM
What about hasChildNodes()?
 
@Scratte also ok :)
 
Super :) And no need for the !! either :D
Though I should probably check to see if there's even a role=status element before checking if it has children :)
 
@Scratte yup :) there are a lot of ways to check if an element is empty (I never checked, but I bet hasChildNodes has !!this.children.length under the hood (or > 0)
@Scratte but you already ensure that by selecting with [role=status], no?
 
return document.querySelector('[role=status]').hasChildNodes(); may error, no?
I expect null.hasChildNodes(); is going to be very upset :)
So I'm back to a ternary :P
 
@Scratte optional chaining
document.querySelector('[role=status]')?.hasChildNodes()
 
11:06 AM
@Scratte only if there is no element :)
@Scratte very :) See @double-beep's comment
@Scratte although be careful - optional chaining is quite new
 
    status = document.querySelector('[role=status]');
    return (status ? status.hasChildNodes() : false);
@double-beep Oh!.. that looks nice and fancy :) What does it do under the hood?
 
@Scratte short-circuit :) JS is smart enough to not even evaluate right-hand side (!! here for consistently returning boolean):
!!status && status.hasChildNodes()
 
^ that looks safe and is probably going to work in Internet Explorer version 0.3 beta.
 
@Scratte IE >= 3 only :)
 
Hehe.. :)
failed! status.hasChildNodes is not a function <-- typical me. Must have missed something
 
11:18 AM
@Scratte hm, how does your final code look like?
 
@OlegValter Not done yet :( I still struggling.
 
@Scratte I mean the part that failed
 
@OlegValter Still on the part that failed. The first issue was the usual :( I forgot that it must be wrapped in an axajStop :(
Now when I log console.log("status",status);, I get a status [object HTMLElement], not a <aside class="js-review-instructions d-none mb12" role="status"></aside>
Yes!.. It's just me.. struggling with the most basic things! I forgot to declare the variable. I'll go and hide now.
 
@Scratte that's ok: if you log the element itself, it will be logged as-is
^ if you use console.dir on an element, it will be logged as a JS object
^ but if you use it as a second parameter to log method, any object will be implicitly converted to string by calling toString method
^ by default it usually creates a string tag of [type Class]
 
11:40 AM
function isReviewActive() {
    var status = document.querySelector('[role=status]');
    return !(!!status && status.hasChildNodes());
}
I was struggling, because I forgot the "var". I just used status = document.querySelector('[role=status]');
But now.. I have a new and interesting struggle.
I need to wrap the call in axajStopWrapper(isReviewActive)
But this little thing doesn't return anything :9
function axajStopWrapper(foonction) {
    $(document).ajaxStop(function() {
        // foonction.apply();
        return foonction.apply();
    })
}
Which makes absolute sense me to. I'm just not sure how to make it return the result of the foonction.apply()
 
@Scratte const is better :) Unless you write for older browsers directly
@Scratte you don't ajaxStop is an event handler :)
^ if you need the result, wrap everything into a promise (but you will have to wait for it to resolve)
 
@OlegValter Argh!..
 
if you really need the result:
 
I really really need the result :D
I have a fix though. I can wrap the calling function, instead of the check. I don't need a result from the calling function.
 
const axajStopWrapper = (foonction) => new Promise((resolve) => {
  $(document).ajaxStop(() => {
    foonction();
    resolve();
  })
});
^ Promise constructor is for making asynchronous tasks more manageable
note that I also removed apply because there is no reason to use it if you don't pass through arguments to it
const axajStopWrapper = (foonction) => new Promise((resolve) => $(document).ajaxStop(() => resolve(foonction())));
^ actually, this is more concise
 
11:52 AM
@OlegValter That looks very nice :)
If the foonction doesn't return anything, can I expect const to be null?
 
@Scratte const to be null?
@Scratte if it returns nothing it will be undefined :) null is not nothing :)
 
I meant the constant variable axajStopWrapper :)
 
@Scratte axajStopWrapper variable holds a function and will always do that :)
 
Yes, I'm using all the wrong terminology here :)
 
@Scratte but, the result of calling it (since I think you are asking me about that) will hold whatever is the result of calling foonction, only wrapped in a promise. If you await the promise, then the result will be just the return from foonction
 
11:58 AM
This is my understanding:
"axajStopWrapper" is a function / a lambda / a closure.
"axajStopWrapper(myVariable)" will hold the return value of calling the function.
 
@Scratte you are correct, it is an arrow function that creates a closure and returns a promise :)
@Scratte re: call - correct, but don't forget that you always have to resolve the promise first to get the value :)
 
Ahh.. so because this returns a promise/future, that is the return value (obviously when I think of it), so I'll need to do what is normally done with that :)
But didn't you already resolve() it? :) (I didn't read the manual on Promises, expect I skimmed it to use ".then()" constructs when I stole some of your other code :-)
 
@Scratte yup, either await or then
@Scratte resolve / reject only sets the status on the promise, it does not change the fact that its still a promise :)
 
Hmm.. I'll try a axajStopWrapper(isReviewActive).then(e => e);
 
@Scratte so even if it is settled ( fulfilled / rejected ), it is still a promise
 
12:13 PM
@Scratte that won't do anything
 
@Scratte so, what do you do with e if you just use an identity function to process it?
 
I think it works a little different in Java :) Which is confusing me here :)
 
@Scratte once you go asynchronous, you can't return to normal flow
 
Or maybe not. I usually use future.get() to get the return value
 
const promiseValue = await aPromise();
 
12:14 PM
I expect that's equivalent to "await promise". Ahh.. yes, I see :)
 
aPromise.then(promiseValue => doStuff());
 
@Scratte it is, but if you use then, then all the code that follows the promise settlement needs to live in the callback
@Scratte async/await was designed to make this more manageable :)
 
@double-beep I see. The ".then" goes into a void return always. Like a consumer, but not quite, as one can chain those ".then" calls :)
 
(if there's a reject(...), you may need to wrap the await in a try-catch or use .catch(error => ...) if you're using .then())
 
I guess I should read a little documentation now :)
I'm getting an await is only valid in async functions and the top level bodies of modules
 
12:32 PM
@Scratte if you use await, your function has to be async :)
 
12:43 PM
Do you mean the foonction?
Turns out replacing "function" with "async" didn't do it. One must add it, so there are two keywords in front of the functionname.. :)
Thank you both btw. These explanations are very helpful :)
 
@Scratte async has to be on the function the body of which contains await :)
 
@OlegValter Thank you :) I thought I had done that with "async methodname()", but it needed to be "async function methodname()" :) So I went to the kitchen and started making some food. Since my brain seems to work better with food :)
It works now :)
 
1:01 PM
@Scratte methods are made async with async methodname() {} :) Remember, functions are first-level citizens in JS, they can stand on their own :) Not all functions are methods in JS
 
I've declared functions inside other functions though.
That's another documentation I didn't read about: Methods and functions and declaring them.
 
@Scratte functions in JS can be declared inside other functions :) They are still not methods
 
Ahh.. I see. They're not attached to an object? Like a method is?
 
^ the only difference is that when you declare a function in another function is that its lifespan is limited to the lifespan of the outer function. Its scope is also limited to this function only
@Scratte only methods are attached to object :)
@Scratte but no one will stop you from doing this:
 
@OlegValter I see :) It's like the world of all languages in one :P
 
1:07 PM
const obj = {
  myMethod() {}
};
const method = obj.myMethod;

method(); //the only caveat here is that you lose `this` binding
@Scratte because it kinda is :) JS is modelled after Scheme (welcome FP), Self (welcome OOP) and Java (welcome familiar syntax) :)
^ without this mashup it would probably one of "those languages" and not take over the web :)
 
In my "other" language, it was very simple. If it's called a function, it has a return value. It it's called a procedure, it does not have a return value. But Java doesn't have those conventions, it just looks at the return value. It also gets confusing that it's still called a "method" even it it's on the class/interface level as a static method, which doesn't require an object instance.
 
everybody found something to their liking in JS, so that's why it is so popular: want to go functional? sure, why not. Want OOP? Yup, that is an option. Wanna mix? Go wild!
 
Is this a good time to say that it seems Python is starting to take over? :D
 
but the lack of strong type system was a mistake IMO :) But this is now solved with TypeScript :)
@Scratte burn, you heretic :)
 
Already on my way to the blackboard to write "I will never say that again" 100 times :D
 
1:14 PM
I would probably learn Python if not for one thing: God. Damn. Significant. Indentation.
I can't understand why on earth these languages exist. For example, I experience intense pain every time I need to write a YAML file
 
On a sidenote: I think the way that new developers are introduced to the "this" keyword it very convoluted.
@OlegValter I got interested in Python due to this alone ;) My bloodpressure rises when everyone in a team have their own preference for indentation (some have a complete lack of it) and the tab/spaces fights.
 
@Scratte to be honest, I think it simply became a meme :) There are actually not many confusing things about this rules in JS
I mean, when one extracts a method from an object and then uses it separately - why on earth they expect this binding to persist?
and then this in static/instance methods - what's so confusing in static methods being this bound to the "class" itself, while instance has itself as this :)
 
It took me a while to actually understand it. When I started thinking about it as the variable name of the containing class, it started making sense to me.
@OlegValter We don't have that issue in Java. It's either an object with a "this", or it's not.
You're either in a static context, or not in a static context. You can reference static stuff in a instance context, but you cannot escape from a static context to an instance context :)
 
@Scratte I just don't understand why everyone doesn't just keep this preference to themselves? :) Who cares what indentation it is in the shared repo - modern IDEs can present you the indentation however you like it without making changes to the files themselves
 
@OlegValter Can it also do that in a file where some of the code is indented by 2 space, then by 4 and some parts with tabs?
 
1:24 PM
@Scratte I am not sure. But IMO this a problem with the process then - no code should be pushed without being run through the linter first
 
@OlegValter So then we need a meeting about what the linter should do, and we'll need to reach agreement.. :P Until an agreement is met, why should I do what someone else prefers, when it's so inferior to "my" way of doing it? :D
 
@Scratte yeah, but the good thing is - you need to do it once to establish a set of rules :)
^ besides, I think team lead should be able to make the decision unilaterally
 
@OlegValter I've worked in projects with 6 "alpha-males". None of them would compromise. As a result, the codebase is one huge horrible mess.
 
and then everyone can do whatever on their local machines
@Scratte well, that's just a bad workplace :)
 
I agree with you. I'd even go for tabs, if that would reach some sort of agreement (I really hate tabs though :-)
 
1:29 PM
^ I mean, everything said above assumes you have a team in the first place :) If people are unable to compromise, then yeah, it is a moot case
 
@OlegValter I agree. But it's easier to fix code than to fix people, so.. when I realized Python has forced indentation I went "Oh! Really? :) Nice.. I should probably learn that :)"
 
@Scratte but when you say "let's migrate to Python", those alphas will eat you alive :) So I think you have better chances at introducing a linter
 
But I haven't learned it yet.
 
@Scratte agreed - poor agreement is still better than an all-out war about what should be "the rule" :)
 
@OlegValter Oh! Absolutely.. but I got interested not because I wanted to change the code, but to limit the risks of that messy codebase in my next employment :)
Do you want the suggested edits user script as it is now? Before I try to remove magic numbers in it? I expect you'd want some bits of it that fetches the usercard
 
1:34 PM
@Scratte can't Python codebase be just as messy as Java if not handled properly? :) Re: tabs - yeah, don't get them too. I think 4 spaces grew on me since I started participating on SO a lot, but I started out with having 2 spaces.
@Scratte not sure I get what you mean?
 
@OlegValter I'm still preferring 2 spaces. But I can live with 4 :)
@OlegValter You mentioned you wouldn't work on stuff that I was working on. Like the user cards. I expected you'd see what I got and modify to be more.. better :)
 
@Scratte well, yeah, you know, it just gets into your habit when you have no choice :) Although I prefer code fences in markdown - pretty much no chance of screwing up
@Scratte ah, I see :) No need, take your time until you think you are ready to go - but if you want a second pair of eyes now - sure
 
@OlegValter It's gotten a little long now.. 700 lines. Most are empty though :D
I think I should perhaps start by refactoring all the querySelectors that depend on a long list of classnames.
 
@Scratte that's ok :)
so, do you need a mini review now?
 
1:55 PM
I'm not sure that's fair given that I feel I still need to refactor the selectors :)
LOL! I couldn't work out what you doing with this:
style.background = linear-gradient(90deg, var(--theme-primary-color) ${percentDone}, var(--black-075) ${percentDone});
Until it hit me that perhaps doing a few reviews would help seeing it in the UI :D
 

« first day (351 days earlier)      last day (1088 days later) »