« first day (2707 days earlier)      last day (2243 days later) » 

12:00 PM
I'm not against them, but they're still essentially global methods
 
main downside I can think of now is that you're going to be jumping around a lot if you want to see all the code
 
What I usually do is I'll have some hierarchy like
 
@Cereal namespaced global methods
 
Site
  Utilities
    Class Something
And have them as actual objects
and if it's osmething so general that it doesn't belong in an obejct
 
user9107868
window.utilities.object = {}
 
12:01 PM
Then I don't think it belongs in the utiltities, and I'll repeat myself if I need it again
I've found that what happens is over time
I'll end up patching that "general" function to account for a million different edge cases for a million different implementations
 
the discussion started with this line btw: github.com/Progressbar/telegram-bot/blob/master/index.js#L22
 
So it should have been separate in the first place
 
I asked the friend how he'd do this in a more readable way, and he said that he'd definitely put it in a separate function
I said that I don't want to have non-important functions in that module, but I also don't want a util module
 
Alright. Certificate replacement validated. Now for the renewal...
 
it's a pretty specific function
 
12:03 PM
so now you're on phase 3 @OliverSalzburg
you can go shit then
 
user9107868
Bye, if anyone wants to help me with my bot, just make a room with me and I'll be there as soon as I can
 
I can have something like index.util.js
and have one for each module that needs a util
 
@towc Just the ternary?
 
@Cereal yeah
 
@Neoares Good call! :D
 
12:04 PM
What's wrong with how it is
 
My partner got the calls I initiated earlier btw :P
 
@Cereal you can't immediately understand what it does
 
He was like "I got 2 weird calls from Manchester a while ago. You know anything about that?"
 
which is bad for code
 
@towc in whos opinion?
 
12:05 PM
you can have a comment, but there are better options
 
It's pretty clear what it does
 
because this is a use of a ternary that would be completely fine with me
it's very clear I think
 
If it has an initiator, command is a substring of unfiltered command, otherwise it's just the unfiiltered command
 
as long as you know what hasInitiator does I guess
 
They could have just used an if/else I guess
 
12:06 PM
@towc don't think it was me, I try to not have a bunch of utils. but when you need them, use them.
 
@Cereal but then you don't have a const
unless you create a new variable
which is free in performance, but bloats the code
 
let command = unfilteredCommand;
if(hasInitiator) {
  command = unfilteredCommand.substring(commandInitiator.length);
}
vOv
 
@Cereal command is const
but now it's let
 
Oh no
Whatever shall we do
 
there's no good reason for command to be mutable
wrapping an if/else in a util function would allow the code to be readable and clear, and for you to still use const
I guess it's details
but I really want to get rid of a lot of hacks in the current projects, as they don't really have a deadline
 
12:09 PM
The point is, there's nothing wrong with how it is
a ternary is not a hack
 
it could be just one line
const command = removeInitiator(command)
I'm really not sure what a good function name for this would be
 
const command = unfilteredCommand.substring(hasInitiator ? commandInitiaor.length : 0)
 
you mean .substring, right?
substring and substr are also fairly confusing
 
welcome to 1998
you'll get used to them
or use slice and be done with it
 
I feel like they should always be wrapped in functions that nobody ever needs to check when trying to figure out how something works
 
12:12 PM
why not just abstract the entire lang?
 
Maybe stop feeling and start thinking
4
 
which I guess are util functions
 
If you think it should be in a function, put it in a function
 
@rlemon oh god you're right, this is partly a problem with javascript
I never thought about it that way
 
Learn ruby, you'll be a happier person
 
12:13 PM
I think it's mostly a problem with the user
there are sensible less "confusing" alts. use them instead
 
Why would that function need to be in a util class anyway
 
@Cereal it's really not important to the rest of the module
 
Maybe some sort of private function
 
it's a little thing that shouldn't get your focus away from the rest of the functions in that file
 
I think you just answered your own question
It's such a little thing - don't touch it
 
12:17 PM
I've said this before, but I really want to see people I respect argue with each other
see how they solve the issues
learn a lot in the meantime
I could invite him to this chat and you can talk about semicolons and code-reviewing that file :P
 
probably not useful
anyone advocating for no semi colons is a moron
 
Your argument for moving that not only into a function, but removing it from the file entirely and putting it god knows where is "It makes me tingly inside"
 
@Cereal it makes him angry
because it can be a lot easier to read than this
 
The ternary or moving it
How in the world is that hard to read
 
the keeping the expression in that function, whether ternary or not
 
12:19 PM
? : is literally the universal syntax for if else
 
and if not in that function, I don't want it in that file at all
if I start making utils, I need to figure out which functions are important enough not to be in those utils
and that's not straight forward afaict
maybe I should just make another function in the file
screw the focus issue. Keep choices simple
 
user9107868
hey could anyone star this so it goes on the board?
 
user9107868
So I dont have to rechat it?
 
actually, starring that one ^ also acomplishes the purpose
 
you were already warned to not spam your bot here
 
12:22 PM
Not on my watch
 
lol
 
people are aware of it, if they care, they'll ping you
 
ROs can remove stars?
 
user9107868
@rlemon not spamming the bot.
 
> You have already voted, but the voting has been cleared by a moderator
 
12:22 PM
I'd love some code review for react too from you btw: github.com/towc/react-todo-mvc/pull/1/…
he said the component at that line should be functional
I'm still not sure about that
 
please don't argue with me, you are. you're trying to get people to talk about it / help / whatever. it's fine that you want that, but we don't need to hear about it every day. you are just coming off a ban that was in part due to you doing just this.
 
the rest of the components shouldn't care at all about the content of that input, right?
 
please stop, thanks.
 
@towc 2 spaces as indent
ew
better use tabs
!!afk lunch
 
@rlemon thought that was directed at me for a good few seconds there
runnable version of the code is here: codepen.io/towc/pen/…
 
12:25 PM
@towc are you using an auto formatter?
    const {
      todos
    } = this.state;
 
@rlemon nope
 
jsfiddle does this shit. it's so ugly
and you're worried about readability :D
 
@Neoares yes
 
that is completely unreadable
 
I used to have more things in there, and realized I might easily want more things later, so it's easier to maintain this way. Do you disagree?
 
12:26 PM
I 100% disagree
 
on the other hand, I'm not using trailing commas there
 
that is ugly af and harder to read than putting them on one line
 
Also, @TheOneWhoMade: if you insist on working with Zirak's bot, just fork the repo. Changes you make for yourself aren't going to be pulled.
 
user9107868
Cerbrus I want to keep the framework. I need it to make him chat.
 
user9107868
 
12:27 PM
Yea, that's not a fork.
Not even kinda
 
@towc there are a few inconsistencies with your formatting for ternaries, but aside form that, missing semicolons, and the silly assignments. I don't see anything glaringly bad
 
@rlemon would you make TodoAdd a functional component?
 
does it need state?
 
for the value of the input
4 mins ago, by towc
runnable version of the code is here: https://codepen.io/towc/pen/b0d3e136d74e46c4fdd7776d7877f600?editors=0011
it's not a button
 
make the input a new component
give that state
 
12:29 PM
oh, uhm
 
controlled inputs should be their own component imo
 
modularizing the shit out of everything is the way to go in react, right?
is this common practice?
 
That's what I do
Everything's a component!
 
should I do it for the inputs of the rest of the todos as well?
 
Hold up
It depends.
Modularizing the shit out of everything can be both beneficial and harmful
Especially since React doesn't really supply a solution for DI
So if you have something in the top layer that needs to be made available at the bottom layer, you're either stuck with passing it all the way down yourself, or resorting to service location
 
user9107868
12:34 PM
Oh Hi madara. If you didn't open my link... i'll repost it.
 
@TheOneWhoMade I saw it
 
user9107868
hMk.
 
I just don't understand what is it that you want to say
 
user9107868
I get stuck on that a lot too.
 
@VSchettino Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@VSchettino What do you plan on doing with our username / ID?
 
Is there an official list of command line switches for Chromium?
 
@Cerbrus bitcoin mining
 
user9107868
@VSchettino which developer network?
 
If he doesn't reply within 5 minutes, I'm flagging the message as spam.
 
12:39 PM
 
@rlemon And that's exactly why
 
@VSchettino don't do this
that is spam
 
Might as well flag that
 
Thanks @Neoares! We already using some of this data, but we need some more.
 
@Ikari ^
 
12:40 PM
ahahaha
 
no
asking in a single room and engaging its users is fine
 
user9107868
why thank you rlemon.
 
user9107868
@Rlemon he's asked in multiple rooms?
 
dumping the question to multiple rooms then ignoring half of them because you can't possibly converse with 3 rooms at once is not
 
user9107868
^ ok i agree with that
 
12:43 PM
hi have any body worked on mongodb?
 
so, just something like this in my code?
class Input extends Component {
	constructor(props) {
		super(props);

		const { value = '' } = props;

		this.state = {
			value
		};
	}

	handleChange = (e) => {
		const { value } = e.target;

		this.setState({
			value
        });

		this.props.onChange(value);
	}

	render() {
		const { value } = this.state;

		return (
			<input
				value={value}
				onChange={this.handleChange}
			/>
		)
	}
}
and I can make everything else dumb except for the root component, in that case?
 
that's the idea.
might pick a better name than Input (just rubs me .. idk why)
 
yeah, I don't like it, but don't know what else to do
 
<ControlledInput /> maybe?
 
<Arararagi /> (pls)
 
12:46 PM
I prefix a lot of things by Field
I don't know why
 
@rlemon I thought it was common. What do you do in your codebase?
well, I guess you use a store
 
Form, not field
 
and never use react state
 
So I need to compile some Java to Javascript... hasnt somebody like made a compiler already..
5
 
FormButton, FormDropdown, FormInput
 
12:46 PM
@towc yea, I use mobx and jsx :P
React is an afterthought
 
@cswl jQuery
 
@Cereal you could just import Form ... and then use <Form.Button ... and so on
 
@Cereal I suppose namespacing them with folders would be fine as well
 
or is that bad practice?
 
12:47 PM
import Input from './myLib/forms/Input';
maybe not
 
I guess it's bad for tree shaking
 
I just like when libs let me import that and not a bundle from index
@towc I dislike that. react-bootstrap does that iirc
reactstrap everything is accessible on its own
so you get to choose which controls you import
 
user9107868
!!afk Forgot about myself.
 
I dunno, I rename things a lot. I keep writing components for a specific purpose, and find it's easy to rework to to be reusable if I need to, which leads to renaming it
 
@user1596138 Retsam? Why the name change?
 
12:49 PM
Madara spanked him
he was impersonating Vapor
@BenjaminGruenbaum it's josiah
 
Java to TypeScript .. you just need to search, everything's there already :O .. jsweet.org
 
@KendallFrey ohh that's a nice main bus i.redd.it/vbls6fl5zul01.jpg
 
lmao
obviously using the flow control mod
 
@rlemon Factorio graphics have really improved, I see.
 
@rlemon It's Jhawins? Why?
 
12:52 PM
3 mins ago, by rlemon
Madara spanked him
 
Oh yeah, it's him in the picture
Ah, lol
 
@BenjaminGruenbaum He changed his name to Vap0r, didn't realize he couldn't change back and had to wait 30 days, I bailed him but still made sure he remembered that changing your name is something you should do only when sure about it :D
 
user9107868
You can't change your name for 30 days after changing?
 
now i'm just reading factorio memes
 
I need to re-write an Java implementation in JS.. so I figured I'd just transpile it .. I found one that does to TypeScript.. maybe I should learn TypeScript :|
 
12:55 PM
@cswl just rewrite it?
 
That's also an option..
 
@KendallFrey what kills me is the tag they put on it
 
oh my god
 
don't deconstruct your storage :D
!!afk
 

« first day (2707 days earlier)      last day (2243 days later) »