« first day (2495 days earlier)      last day (2676 days later) » 

08:46
uhm you wut?
var newObject = Object.create( Object.prototype );
that's... do people do that?
user5738123
sup
@towc Where have you seen it?
@BenjaminGruenbaum Do you have an example app out there that uses DI with mobx?
And not just import the store instance and use @observer magically
ok "essential js design patterns" is a bad book
wait, no you need something that'll inject props
@towc Addy's? It's just old and things have changed
@BenjaminGruenbaum That's not what I asked.
@BenjaminGruenbaum that's fair
any more recent ones?
I asked whether you know of an actual app that exists that uses something (even in-house)
09:04
@MadaraUchiha oh really? I guess I'm stupid and can't read :P
I've been having a look at other general ones, and they're real good (like source making's), but it would be nice to have something js-specific
Some MobX in house at TipRanks did it but we removed it before handing it out to OptionHouse - I can email John and see if he's cool with sending you a copy of the code back (I have a version in their source control).
@BenjaminGruenbaum I can find a library, Inversify seems like a prime candidate
But I want to know whether there's someone out there that actually does this
In the wild? I don't know anything open
I don't want to run into architectural problems 2 months in that I won't be able to solve because of the choices I make now
09:06
I know people who told me they do this and that it works well. It's also extremely common practice in other ecosystems.
@BenjaminGruenbaum Yes, when you have control over the object graph construction
It's basically the same architecture you'd have in a WPF app with injectors or with Java UIs. Basically React in JS is the only popular toolkit without DI.
That's the point of DI, after all, to essentially absolve you from newing everything everywhere
The point of DI is not to not "new" it's to invert control - you know this.
But you don't use new here because React constructs everything for you
09:07
It's to remove the concern of obtaining dependencies from the component.
Control is already inverted here
And not in a way that's favorable to services
Not really (since you call createElement yourself and that calls you)
The only reasonable way I've seen is to use property injection and rely on @observer being magical
But if you need a "hook" you can just use a higher order component like connect and its friends do.
(i.e. not in props and not in state)
09:07
Observer is not "magical".
And it's fine to use properties that are not in "state" or "props" for updates. In fact I'd recommend against using setState at all if you're using MobX since it's just a shitty observable that's not synchronous.
There is nothing magical about change detection, I encourage you to implement it yourself with getters and setters once and see how easy it is.
@BenjaminGruenbaum I know how easy it is, I saw your 9 line implementation way back when and did it myself to an extent
I'd roll my own injector to be honest, because it's like... 20 LoC and it's pretty trivial.
But it is magical if you're a guy who hadn't worked with React before that was kinda forced on us.
If you don't know how your tools work then everything seems magical.
But it's simple in principle, and it's a solid abstraction.
I'm not questioning that
09:10
"Unfamiliarity" is a weak argument when describing the cost of an abstraction.
I want to see an example of it being used
I want to try and spot out the weaknesses beforehand, because it isn't a trivial React "architecture"
You're right, and you're right to be concerned.
This is however trivial everything else architecture.
Because right now, Nitzan sent our a guy a feedback that using anys everywhere might not be a good thing
I don't really trust his technical strength
write a function Injector that returns an object with a add method that takes a type or name and a function - and it returns a function Inject that decorates either the constructor of a component or creates a HoC for the props.
@BenjaminGruenbaum Again, I know how to write this
09:11
My approach after working with Fiverr for a year is to say "fuck you" and dictate everything to them.
And it's not what I'm afraid of.
Don't give them any choice or creative design freedom.
What are you afraid of then?
@BenjaminGruenbaum Yes, because that worked out so well with weeks worth of back and forth
@BenjaminGruenbaum I'm afraid of writing code with a certain architecture that's going to get completely ignored because it's hard to use
I'm afraid of shortcuts. I'm afraid of defining types twice, I'm afraid of annoying boilerplate one would have to write
And I can't easily predict those things without looking at an example
And spotting out "well, writing that every time would be annoying" and "Meh, now you have to use any to escape", and things like that
I don't want to discover those things 2-3 months into the dev process
@MadaraUchiha I'd rather have weeks of back and forth if we're going to maintain the code.
@BenjaminGruenbaum I'd rather have both
09:15
@MadaraUchiha architectures get ignored for many reasons - but being hard to use won't be a problem here.
I'd rather not having to have the weeks of back and forth, and be able to maintain the code
The developer being lazy or stupid is a much more common reason for architecture being ignored.
By the way, just do constructor injection and not props injection, that's simpler.
@BenjaminGruenbaum You can't, you don't control the construction
The constructor is always called by react
Yes, but you can decorate it
class MyComponent extends Component {
  @Inject("UserStore")
  constructor(private userStore: UserStore) {

  }
}
or something like that
@BenjaminGruenbaum Then it doesn't extend Component correctly
(Especially if I also have props and/or more than one service)
09:17
@MadaraUchiha what do you mean?
Props might be cleaner, but I'm not sure I'd care and injecting in the constructor is simpler.
user5738123
 var loadArray = [];
                    loadArray.push([[0], [10]]);
                    loadArray.push([[1], [11]]);
                    loadArray.push([[2], [12]]);
                    loadArray.push([[3], [13]]);

                    var index = loadArray[0].indexOf(1);
user5738123
why is this not working?
user5738123
i get -1
@eBay Because the value 1 is not found in the array [[0], [10]]?
user5738123
09:19
ok
@BenjaminGruenbaum Say MyComponent needs a UserStore, but also some props
How would you do it?
I'd inject the UserStore and pass the props as props.
In second thought I'd probably pass the injection via props via a HoC - mainly because I've used it before and it works and I didn't try constructor injection in React
If you'd like, we can do a talk on DI in React at the next React IL or something
OK
I don't want a theoretical discussion of what can be done
I'm familiar with DI :)
I want to hear from someone who actually did it, and knows what's wrong with it
user5738123
var index = loadArray[0].indexOf([[0],[10]]);
I meant giving a talk together, I wouldn't suggest that if I didn't think you know DI obviously :P
user5738123
09:21
this does not work either...
@eBay did you read the chapter I sent you?
@BenjaminGruenbaum Sounds good, after I get this figured out
Also, looks like Nitzan is out for lunch
@MadaraUchiha nothing is wrong with it and the entire industry is doing this except React :P
Got a meeting or smth
lol, ok, bring Danny/Gal/Whoever - I'm waiting
09:22
Care waiting till ~13:00?
Or are you very hungry?
Is this normal orbit?
user5738123
that's e = mc^2
user5738123
einstein came up with it in 1910's
? How's that equation relevant
@Tobiq Seems OK
@eBay No, it... really isn't.
09:24
Hi guys, I have a function which sorts and returns data which I use to plot on d3: https://gist.github.com/Daruchini/148396eefdc06c1e5596e7fc5e20447a

As you can see, I add a class to a data series on the return, how would I go about adjusting the series containing the class based on something external?
It's universal gravitation
The only way I can think of doing it is saving a global variable containing a state and then performing an if check before binding the class and returning, just wondered if theres a more efficient way
@MadaraUchiha Sometimes it whips out of orbit
like gets further and further away, is that normal?
@Tobiq No. In an ideal system (like a computer generated one), orbit should always remain the same and energy should never be lost (or gained).
@Tobiq My guess is that it gets too close, and there's a rounding of a pixel somewhere in there which affects the computation
So it gains velocity until it reaches escape velocity and deorbits
when it rebounds, it basically flips velociity, because of the relative density difference,
but as it gets gravitionally attracted, its velocity increases
so it's like it constantly increases, no conservation
somethngs wrong
09:28
@Tobiq Gravitation dictates that the closer the two objects are, the stronger the force. And the stronger the force, the stronger the acceleration is
I'm guessing that the distance is rounded
It's 1.01 units away, but it gets rounded to 1 unit away, that difference is squared, and velocity steadily increases because the force calculation has wrong parameters.
I get what you're saying
(Again, pure guess, haven't seen any code)
I'll log total energy
@Tobiq looks fine
But just implement gravity, it's pretty simple to implement gravity with newtonian-esque laws.
All you need to do is just implement that for updating the acceleration - and then speed and position are derived from that.
atm im just doing m*M/r^2
09:32
(given you know the integration constant, which you do since you have the old speed of positions)
im doing: factor = unitVectorOfSeperation * m* M / seperation^2
particle.velocity += factor * otherParticlesMass
unitVectorOfSeperation being the gravity coefficient?
not using G
its the unit vector of their seperation vector, difference in coordinates
@Tobiq You are, it's just set to 1 😛
^, but not using like the IRL G
09:35
@Tobiq How's that different from separation?
unit vector magnitude = 1
its like a direction
Ah, ok, I see it
It gives you the direction for the factor
And this is done per axis?
You'll need to calculate in both X and Y axes to move propertly
im using vectors
not working per axis
@Tobiq do you mean you're using polar coordinates?
But factor and particle.velocity are scalars
09:37
both are vectors ^, in my program
Because the fact you're "using vectors" isn't related to your axis system (you're using vectors either way)
velocity has to be a vector
How? You don't have operator overloading
How do you signify direction?
I'm using a vector class i made
Yes, but you can't new Vector([1,2]) + new Vector([2,3])
(or new Vector([1,2]) * 3, for that matter)
new vec2(1, 2).add(new vec2(2, 3))

new vec2(1, 2).multiply(3)
09:38
@Tobiq That's not the code you showed though
Yeah, i was just simplifying, same thing
factor is the result of division, that has to be a number
Ah, OK
its a vector, because the unitvector, is a, vector
I was using diff * m * M / r^2, where diff is the difference in coordinates - seperation
and that conserved orbit, no escapes
but the focus of all orbits was only the sun
the elliptical orbits war centred at the sun, unlike natural orbits with 2 focii
09:52
How many items do you expect to have there eventually?
Also, you might want to actually read the V8 tips I sent you last time you told me to shut up.
And read everything by mrale.ph :P
If #items < 1000 don't really bother. I think you can parallelize a lot on the GPU core with WebGL if the flow requires it
10:43
If anyone has a few minutes, care to take a look at a problem im having? I've got a simple line graph which when clicked I record the x,y coordinates at that position, I'm then creating a circle and trying to place it on the graph at the specified location given by the coordinates. The graph works and I can see the circle moving, but its not sitting at the correct location and I have no idea why. I've created an MVCE here: jsfiddle.net/x03exh04
What do you mean, @BenjaminGruenbaum?
11:21
@Tobiq do you have less than 1000 vectors
Hi all. I tried writing something like zipWith in js. its only a few lines but I'm getting some errors of which I don't understand why they happen. my function is here: jsfiddle.net/dn58c679
@ngmir Welcome to the JavaScript chat! Please review the room rules. Pleasedon'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.
i'd be thankful if someone could give me a hint about what to look at because right now im at a loss what the problem is, especially why I get an error for ly.slice but not lx.slice
@BenjaminGruenbaum many vectors per many objects, why?
@BenjaminGruenbaum Continuing from "don't use setState, use MobX": What happens when you want to instantiate the component in isolation?
11:33
@ngmir zipWith(xs,ys,f) There's your problem
@KendallFrey argh. thanks.
protip: when in doubt, console.log
i did do that, i just got confused by the error messages and completely oversaw that mistake. thanks anyway.
@MadaraUchiha what do you mean?
Isolation from what? MobX? Fuck that :D
Although it would technically work with regular data, but won't be reactive.
I recommend making MobX a core part of your stack and not repeat my mistakes :D
11:53
Hello
National holiday wohoo!
jealous
HELLLLOOOOO
12:09
@KamilSolecki what national holiday?
@BenjaminGruenbaum Assumption Day
@BenjaminGruenbaum day of the Polish military, in memory of winning back Warsaw from Soviets. Also in line with some big church event, and me being in a very religious city means swarms of piligrims
At least 100K of them
you're polish?
Hola como estas
Estoy bien, gracias. Y tu?
jajaja muy bien, tu porque habo ingles?
12:17
English only, please.
That was just a series of random spanish words
I know
Hence: "English only, please"
@MadaraUchiha what about klingon?
@Daruchini bel English Hol neH.
jlyaj
12:31
@KamilSolecki oh cools, I'm actually Polish
Well, originally, have a citizenship and all
Have never lived there
Swarms of pilgrims are fun (I lived for quite some time in Jerusalem, guess what? Pilgrims :D)
I don't classify based on political boundaries. I am a mammal of planet earth/
Anyone here used Electron before? I am trying to decide whether to use it, or whether I should learn some other language for desktop apps
@Alesana depends on how well you know NodeJS.
@Alesana Electron is what I normally use for desktop apps that need a GUI.
It's infamous for being bad at memory management, but it works for lightweight stuff just fine.
I am not so good with NodeJS but I know JS in general so it couldn't be too hard
I am building a pretty simple app
Really I built a PHP app thinking I could just load the page with Electron but now I'm realizing it would probably be easier to rewrite it in JS than have Electron talk with my PHP server
12:42
So you have to decide between a desktop app and one that runs in a "normal" browser?
12:52
huh nice! Yeah, I bet you guys had tons of pilgrims there 😀 Only problem is when you gotta drive somewhere, because they walk through the roads.
Anyways you should come visit the motherland sometimes :P
Yeah, well I am wanting to build a desktop app that's the whole reason I would use it
13:20
morning everyone
morning
its 3PM
yeh, tell him @Tobiq !
@Tobiq UGT
It's always morning when you log into chat, always night when you leave.
13:31
@KamilSolecki I'd love to, I'd also meet Bartek and Mitzy and all the gang
There are actually a bunch of Polish chat people, buy them a beer :D
Speaking of beers, I'm in Amsterdam between the 12th and the 18th of September for a conference. If anyone wants to come and beer please let me know.
4
Going to pin for a day or two
you should hit up roel
Can I add some sort of transition animation on with the following js code
document.getElementById("raasi-output-graph-wrapper").style.visibility = "visible";
or am I better off using jquery
@Daruchini Transition on opacity, and use pointer-events: none
What browser support do you need?
(Especially in terms of the touch browsers)
How far back do you need to support Safari/Android?
13:40
no you can't, an object is either visible or hidden, to do this you need opacity: 0;``opacity: 1;
@SamApostel Welcome to the JavaScript chat! Please review the room rules. Pleasedon'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.
I'm not concerned with mobile browsing
oh I'm quite liking some of the transitions in jquery ui :p
jQuery is pretty hot stuff
anyone interested in helping me with stackoverflow.com/questions/45692696/… ? :)
@KamilSolecki @RoelvanUden
14:00
@KamilSolecki Sorry man, my coworker from out of town offered to take me out for dinner and grab a movie as thanks for housing him this week.
@SamApostel Sure! I close voted it because you were given an answer that seems to be based on you not following instructions, and setting up the wrong local path.
Has anyone ever written code that compiles first time
like ever
@Trasiva but the answer doesn't help me, I state in my OP that it's the first time that I try use a GitHub lib
@SamApostel He gave up an updated answer, did you bother trying that? Because it seems to me that your problem is that you're not setting the local path right.
I did try that, my problem is that it doesn't work on iOS as web app but it does work on desktop safari
14:05
I have a container div which holds multiple child content. Using jQueryUI, should a show/hide animation automatically be inherited by its children?
Did you check the console? Look for errors? Because I just set it up, it works fine
does it work on iOS for you?
I don't do iOS support.
But it runs on android, Chrome, FF, Edge, IE and mobile Chrome
My div: <div class="col-sm-12" id="raasi-output-graph-wrapper"> - My jquery: $("#raasi-output-graph-wrapper").toggle("highlight");
@Daruchini Why don't you try it and find out?
14:07
the js is wrapped inside a button click function and once clicked, the scrollbars are extending but nothing is being toggled
@Trasiva I have tried it
@Daruchini That doesn't seem to be a valid toggle option
According to the API
Did you make sure to include the jqueryui library?
Because basic jquery has a toggle function, and that function is invalid. Look at your dev console for errors.
14:09
checked, no errors
Then make a jsfiddle example and maybe someone will look at it.
@Trasiva haha no problem 😀 I have a national holiday today, so hit me up if you want :D
@KamilSolecki I probably will tonight after work. Did you add my friend?
14:20
When writing your own TSLint rules, the rules must be compiled to JavaScript before TSLint can read them :(
@MadaraUchiha but it spends so much time loading the compiler
@ssube I know :/
that's silly
hello, can someone tell me, if i use this code
14:31
1 message moved to Trash can
@BrightSun Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
@BrightSun Paste, CTRL+K, Enter
Markdown in chat is weird.
I'm not surprised that nobody has raised an issue, it doesn't seem like the most common thing (most people get rules from npm, I bet).
image = document.createElement('img');
      image.src = $('myimage').css('background-image');
      image.onload = function () {
          requestAnimationFrame(startRender);
      };
But can't you just replace the require equivalent with a TS-wrapped version?
@ssube I was looking for it
14:32
Deciding what tsconfig to use for rules will be tricky.
With webpack, for example, you can have a webpack.config.ts if you have ts-node as a devDep
will image be loaded twice?
But I don't see this feature with TypeScript.
as background and as image.src
@BrightSun Assuming myimage is already fully rendered, no.
The background will (almost always) be cached
its not fully rendered
It looks like you could replace that function easily enough and use a compiler.
@BrightSun Then there's a possibility that the background will be downloaded twice
ok, thank you
Use the Network tab in your devtools to see the behavior.
I'm unsure what each browser does.
@ssube You mean, patch tslint?
14:35
I don't see any other way, besides hooking require globally.
Does jquery toggle reset elements which use a data source? I've added a toggle to a graph but each time it resets its content. Strange
@ssube To be fair, considering I'm using webpack.config.ts it might just work out after all
Does webpack/TS use something like babel-require for that?
Guys, im going to create a resume but im having hard time to do it. I have 1 year exp
what should i create to have good resume, i mean pleasing or something. idk
14:47
Q, I am trying to hit a 3rd party API that recently implemented CORS. I am trying to use JSFiddle to hit this by using jsonp for the ajax request, but then get the json out of the result (which it returns). However, because JSON is returned it keeps breaking the return/callback as it has an invalid : from the first item in the JSON. Is there any way to get around this, or is it all security measures at this point and just impossible to do without a backend?
@BrightSun Browsers are smart enough to know only load the same image once. If the same image url is used by multiple items (css and img in your case), they will all wait for that one image to load.
jsfiddle.net/aanders50/3aettrzq/166 (example), can't provide an API key, but the error it returns each time is: "Uncaught SyntaxError: Unexpected token :", as it tries to consume the returned JSON object.
@EarvinNillCastillo Having more experience would help
@Austin cors implementation may mean http header instead of jsonp. The former may allow you to get json (non-p) cross domain.
@OliverSalzburg yes but i want to leave now in the company and go to the next step.
14:50
@ssube Yes
And it looks like the rules must still be compiled to be valid
It explicitly looks for JS files
@EarvinNillCastillo If you don't have much stuff to put on your resume, make more stuff to put on your resume. Involvement in open source software is always great
my plan is to work for 1 year and im going to search for a better benefits with good salary
Trying to "make it look good" will just annoy whoever reads it
Unless they're new on the job and it's the first resume they had to read
That's not to say that the presentation should be bland. Definitely try to stand out
I'm not going to tell you how though. That's my secret for when I need a new job
i am more like maintaining the existing programs rather creating new ones. even tho i have created 7 programs
I wrote 7 programs on the day I learned to write programs
14:55
haha. i mean 7 major requested program.
im working at a manufacturing and its not that i always sit and code. sometimes need to deal with tech supp in offices if needed.
So the trick with resumes early on is to sell yourself, not your job history
and run errands for the person in charge
If you want to put that on your resume, say what the programs were meant for, what technologies you used to implement them and what impact they had. Cost and savings is also a nice data point if you have it
What are your accomplishments, any certifications? Have more descriptions of what you did at your 1 year job
The more job experience you have, the harder it gets simply to contain it to a single page
!!afk scrum
ohhh
tthanks for the tip!
14:59
@MadaraUchiha boo. I remember seeing that part. Not much to do but build-and-link or fork it. I have some backlog tickets for custom rules, so let me know which way you take and how it works.

« first day (2495 days earlier)      last day (2676 days later) »