geeves posted:Will your sign have the JavaScript equivalent of dead fetuses on it? you mean coffeescript?
|
|
# ? Mar 28, 2018 03:33 |
|
|
# ? Jun 5, 2024 23:53 |
|
Doom Mathematic posted:$('.this-element-sure-as-heck-does-not-exist').click() just silently succeeding when it really, really would have been more helpful if it failed noisily. In my last days with jQuery I would almost undo what it was doing. code:
|
# ? Mar 31, 2018 10:21 |
|
For anyone that works regularly with JS but has only ever done so via frameworks or libraries but wants to learn more about JS, https://www.udemy.com/understand-javascript/learn/v4/content is an awesome course. I'm about a third of the way through it and I understand so much more now.
|
# ? Apr 4, 2018 15:16 |
|
Is anyone well versed in Vue? I'm making the transition from React and am having some difficulties with some core concepts.
|
# ? Apr 4, 2018 17:31 |
|
Using custom attributes for view logic has always been a great idea, glad to see Vue carrying that forward.
|
# ? Apr 4, 2018 18:56 |
|
Knifegrab posted:Is anyone well versed in Vue? I'm making the transition from React and am having some difficulties with some core concepts. The big thing to keep in mind is that Vue syntax is templating rather than literally-the-JS-code like JSX, so every variable binding you do in it is pulling in that var as declared on the corresponding component class.
|
# ? Apr 4, 2018 20:55 |
|
huhu posted:For anyone that works regularly with JS but has only ever done so via frameworks or libraries but wants to learn more about JS, https://www.udemy.com/understand-javascript/learn/v4/content is an awesome course. I'm about a third of the way through it and I understand so much more now. Seconding this course. I went through it right before I started my bootcamp last year and the time spent watching it has paid itself forward quite nicely.
|
# ? Apr 4, 2018 23:15 |
|
huhu posted:For anyone that works regularly with JS but has only ever done so via frameworks or libraries but wants to learn more about JS, https://www.udemy.com/understand-javascript/learn/v4/content is an awesome course. I'm about a third of the way through it and I understand so much more now. Best course and teacher for Javascript imo. His Node course is really good too.
|
# ? Apr 5, 2018 12:53 |
|
Why is Express the most popular backend solution for JS? At least from the documentation, coming from Flask and Django, Meteor looks much more like a backend solution than Express.
|
# ? Apr 7, 2018 01:05 |
huhu posted:Why is Express the most popular backend solution for JS? At least from the documentation, coming from Flask and Django, Meteor looks much more like a backend solution than Express. Express was the first to gain traction, that's it. Meteor had the issue that it was really experimental when it first started (and _very_ opinionated on how to do things). I think it's not so bad nowadays but its credibility is kinda shot. It does have some hardcore fans though.
|
|
# ? Apr 7, 2018 01:22 |
|
gmq posted:Express was the first to gain traction, that's it. Whelp. Does that mean there are standard ways to structure an Express project at least or does everyone kind of just build their own?
|
# ? Apr 7, 2018 08:06 |
|
huhu posted:Whelp. Does that mean there are standard ways to structure an Express project at least or does everyone kind of just build their own? Try visiting glitch.me, it immediately sets you up with one in a free sandbox
|
# ? Apr 7, 2018 09:21 |
Every time I have to make a project with a backend I check out what's out there in Javascript and... end up doing it in Rails. It's not that the javascript backend solutions are bad but you end up having to glue so many things together (and sometimes there's no third-party package that actually works so you have to make your own) that it ends up being very time consuming.
|
|
# ? Apr 7, 2018 17:38 |
|
The good thing about express is it makes you appreciate real opinionated web frameworks.
|
# ? Apr 7, 2018 17:38 |
|
Thermopyle posted:The good thing about express is it makes you appreciate real opinionated web frameworks. That was the conclusion I came to looking at the documentation. Could be a fun (awful) exercise. Maybe my next two projects should be a Python web server with sockets and an Express backend.
|
# ? Apr 7, 2018 17:39 |
|
Express is fine if all you need is a system to map a request to an endpoint and execute a chain of functions to get a response. If I was doing any serious work I wouldn't use it (or JavaScript tbh) because of how un-opinionated it is.
|
# ? Apr 7, 2018 17:49 |
|
Another good thing about express is that if you're shaky on the fundamentals of how a web app server works it will help you understand how more opinionated frameworks work under the hood.
|
# ? Apr 7, 2018 19:23 |
|
The key thing with Express (and with other API copycat frameworks like Fastify) is that it makes it dead simple to set up a couple of routes that return whatever data or static files, while Meteor wants to make you jump through hoops to get started, has a whole elaborate pub/sub system it wants you to use instead of just making a JSON endpoint for the data generation you've already got, and it doesn't even help with the reasons you'd actually want Node on the server (like isomorphic page rendering). Compare to, like, next.js, which is strongly opinionated but uses standard npm setup and gives you some real performance benefits for having a Node server.
|
# ? Apr 7, 2018 20:12 |
|
it's so unopinionated it doesn't even bother to provide basic http parsing outta the box, you gotta install some other poo poo middleware for that https://github.com/expressjs/body-parser
|
# ? Apr 8, 2018 02:21 |
|
like while i don't mind a modular unopinionated framework (i think django, on the other side of the scale, is worse), express.js showcases the worst trait in the node.js community: move as much random junk into dependencies so it can go unmaintained under someone else's github repo. of course all of these are constantly at v0.0.5 and break every two weeks because some new fad convinced them to rewrite the api.
|
# ? Apr 8, 2018 02:41 |
|
Sounds like I'll broaden my backend knowledge to a language that isn't JavaScript.
|
# ? Apr 8, 2018 03:15 |
|
Suspicious Dish posted:it's so unopinionated it doesn't even bother to provide basic http parsing outta the box, you gotta install some other poo poo middleware for that https://github.com/expressjs/body-parser Meh, I've built a proxy using express and the lack of body parsing was kind of nice. Working with buffers by default can be pretty good.
|
# ? Apr 8, 2018 16:47 |
|
WebGL question. I've made a program that draws fine on computers but not on my iPhone. I get a shader linker error and unfortunately it's hiding the details from me. At the end I get "false" for the linker status: code:
But trying to ask about the problem just returns an empty string: code:
I have no idea where to go from here, since the debugger is unable to tell me where to start looking. I do get a real WebGLProgram object when I put the expression "this.program" into the Safari remote web inspector console so I know it's not that. Here's a similar post: https://stackoverflow.com/questions/21803567/glgetshaderinfolog-returns-empty-string-but-shader-program-is-not-linked-correc quote:Found it. The reason were several varyings and uniforms that did not specify a precision qualifier: It may not be related though - they seem to have not tried using getProgramInfoLog. Both my shaders already say "precision mediump float;" at the beginning. Shouldn't that be enough to avoid confusion? Is iOS particularly fragile about this? It feels like I'm just grasping at straws randomly because I have no linker error message. I don't know that precision is even what's wrong. Happy Thread fucked around with this message at 02:08 on Apr 10, 2018 |
# ? Apr 10, 2018 01:33 |
|
post the sample
|
# ? Apr 10, 2018 02:15 |
|
It's http://encyclopediaofcode.glitch.me/. The relevant code trying to do the linking is in the Shader class and it throws, so the debugger will find it. The full source code can be viewed through the navigator at the bottom of the page. edit: The GLSL / the actual shaders themselves are located in the Phong_Model class. Happy Thread fucked around with this message at 05:15 on Apr 10, 2018 |
# ? Apr 10, 2018 05:09 |
|
So with async await and try catch making a comeback how do you guys handle variable scooping when assigning new values in a try catch? I just declare a let variable right above the try block personally.
|
# ? Apr 10, 2018 20:05 |
|
Knifegrab posted:So with async await and try catch making a comeback how do you guys handle variable scooping when assigning new values in a try catch? This is what I've taken to doing, even though it is a little ugly/annoying. Alternatively instead of using a try/catch block you can chain a .catch onto the method you're awaiting. If the catch runs, the variable will be set to whatever you return from the catch. Its a matter of whatever you find more readable I guess.
|
# ? Apr 10, 2018 21:42 |
|
I've successfully combined promises and async-await without getting confused or seeing the need to switch back to try-catch and the weird scope-related considerations that come with it. Inside an es6 class I do the following. Notice in the second half how I wrap the await usage in an Array.reduce() call to string the promises together and call each one after the previous finishes. This pattern works. It solved my race condition with promises writing to my database out of sequence. code:
code:
Happy Thread fucked around with this message at 22:43 on Apr 10, 2018 |
# ? Apr 10, 2018 22:29 |
|
Regarding my other post, I guess there might not be too many WebGL people on board who target iOS. I think I might start breaking the code behind my URL above soon (to try to see what triggers the error) if no one else who might know the answer will be needing to see it anymore.
|
# ? Apr 10, 2018 22:41 |
Is it possible in TypeScript to have a namespace defined in multiple different files, and have them just add to that namespace as you import? I.e. how C++ does it. Specifically I want to have an application specific namespace e.g. MyNamespace and then do TypeScript code:
This is mostly to avoid type clashes on module names, for instance.
|
|
# ? Apr 12, 2018 09:53 |
Dumb Lowtax posted:Regarding my other post, I guess there might not be too many WebGL people on board who target iOS. I think I might start breaking the code behind my URL above soon (to try to see what triggers the error) if no one else who might know the answer will be needing to see it anymore. My eyes just start kind of glazing over at that layout, sorry.
|
|
# ? Apr 12, 2018 10:55 |
|
Joda posted:Is it possible in TypeScript to have a namespace defined in multiple different files, and have them just add to that namespace as you import? I.e. how C++ does it. Off the top of my head, it might make more sense to do something like this: TypeScript code:
TypeScript code:
|
# ? Apr 12, 2018 13:35 |
|
Joda posted:Is it possible in TypeScript to have a namespace defined in multiple different files, and have them just add to that namespace as you import? I.e. how C++ does it. You can't import Namespaces. Namespaces are the new name for what TypeScript previously called "internal modules", which is contrasted with "external modules". External modules are CommonJS type modules where you would explicitly export them. Internal modules are something TypeScript assumes just exists via some mechanism (script tag loading, concatnation, etc). You can not use Namespace and External modules at the same time. From how you want to use them, it sounds like you want to create files with external modules, using "import * as blah from './file1'". However, I don't think you can combine them with import statements, nor should you really. If you have some library that is a thing, you should use something like Rollup to combine your multiple files together, and then import it again in your app.
|
# ? Apr 12, 2018 16:56 |
|
If you have an object coming from the backend as JSON would you make that a class or an interface in TypeScript? It seems like it’s basically just cast from the JSON so even if you make it a class you don’t get any class methods with it.
|
# ? Apr 16, 2018 13:06 |
|
smackfu posted:If you have an object coming from the backend as JSON would you make that a class or an interface in TypeScript? It seems like it’s basically just cast from the JSON so even if you make it a class you don’t get any class methods with it. Yes you should make an interface out of it. It's not cast in the usual sense, the object is parsed from the JSON. Making an interface out of it just tells the TypeScript compiler that the object TOTALLY LOOKS LIKE THIS TRUST ME. It makes no difference in the actual execution of your code. The reason you don't get methods is you can't encode methods in JSON, as that would be a huge security hole. If you want this item you are transmitting to be a class, create an interface for the fields you want transmitted, then make your class take that interface in the constructor and use it to initialize itself.
|
# ? Apr 16, 2018 16:00 |
|
smackfu posted:If you have an object coming from the backend as JSON would you make that a class or an interface in TypeScript? It seems like it’s basically just cast from the JSON so even if you make it a class you don’t get any class methods with it. I ran into this problem (not with Typescript) but these answers were informative, especially kiewic's. I just ended up going with writing a different custom class object parser for the object in the code of each client page though.
|
# ? Apr 16, 2018 16:01 |
|
smackfu posted:If you have an object coming from the backend as JSON would you make that a class or an interface in TypeScript? It seems like it’s basically just cast from the JSON so even if you make it a class you don’t get any class methods with it. I just make it a type rather than an interface but for this purpose it really doesn't make any difference, I don't think.
|
# ? Apr 16, 2018 16:27 |
|
Is there any sort of advanced object filtering library I can leverage instead of rolling my own? I have to implement something on the level of Newegg's Power Search, but also with user selectable comparisons or value ranges, dates and date ranges. I basically want the ability to dynamically generate SQL WHERE clauses and run it against an array of objects.
|
# ? Apr 20, 2018 05:02 |
|
porksmash posted:Is there any sort of advanced object filtering library I can leverage instead of rolling my own? I have to implement something on the level of Newegg's Power Search, but also with user selectable comparisons or value ranges, dates and date ranges. I basically want the ability to dynamically generate SQL WHERE clauses and run it against an array of objects. The easiest way I've seen it done in any platform is to leverage the LINQ expression builder in C#, and make the JS just post an object consisting of the set of sorts and filters and having the server do everything. The server side code looks like this: https://gist.github.com/afreeland/6733381
|
# ? Apr 20, 2018 11:59 |
|
|
# ? Jun 5, 2024 23:53 |
|
If your data isn't too big, you could do that all client-side with lodash. It can be made to do basically anything LINQ can, but with more awkward syntax. There's also straight up LINQ ports in JS https://github.com/mihaifm/linq
|
# ? Apr 20, 2018 13:35 |