|
I use webpack. It wasn't as challenging to learn as you might expect and it really does a lot for you. I think depending on the rest of your stack and what frameworks you're using webpack might be a more or less attractive option. I use Rails and React and webpack definitely simplifies a lot for me. I actually don't know Gulp or Grunt and have been meaning to learn one of them just so I can say I've used it during interviews and such.
|
# ? May 19, 2016 16:21 |
|
|
# ? May 15, 2024 03:57 |
|
Thermopyle posted:You use webpack and don't use require. You use ES6 modules and use npm to manage your packages. Ok. Good to know. I am interested in using ES6 stuff so if WebPack will let me do that in the browser then that's the way to go. It's just super loving lovely that first it was grunt, then it was gulp, bower was in there somewhere, then it was browserify, and now it's webpack. I am glad I have yet to get very deep into build tools since it's just a waste of time since something new that you just HAVE to use is out every week. It also really, really sucks that any courses and tutorials on JS frameworks now almost always rely on you picking up a build tool as well. I'll give WebPack a shot, I guess, but I bet as soon as I learn it, it'll be old and poo poo.
|
# ? May 19, 2016 16:41 |
|
Noam Chomsky posted:Ok. Good to know. I am interested in using ES6 stuff so if WebPack will let me do that in the browser then that's the way to go. It's just super loving lovely that first it was grunt, then it was gulp, bower was in there somewhere, then it was browserify, and now it's webpack. I am glad I have yet to get very deep into build tools since it's just a waste of time since something new that you just HAVE to use is out every week. It also really, really sucks that any courses and tutorials on JS frameworks now almost always rely on you picking up a build tool as well. Apologies if it's been posted before.. e: it has
|
# ? May 19, 2016 16:51 |
|
Is there a proper name for what I'm doing to do here with runUpdates? Basically I'm looking to pass in an initial state and some list of updaters to modify that state without having to do something like updateSomeVal(updatemyThing(state)) as that gets ugly pretty quickly.code:
|
# ? May 19, 2016 18:31 |
|
https://en.m.wikipedia.org/wiki/Visitor_pattern
|
# ? May 19, 2016 19:21 |
|
Horn posted:Is there a proper name for what I'm doing to do here with runUpdates? Basically I'm looking to pass in an initial state and some list of updaters to modify that state without having to do something like updateSomeVal(updatemyThing(state)) as that gets ugly pretty quickly. Sounds like function composition JavaScript code:
|
# ? May 19, 2016 19:53 |
|
Sedro posted:Sounds like function composition Thanks guys, this was enough for me to figure it out. If anyone else is wondering the lodash equivalent of this is _.flow.
|
# ? May 19, 2016 20:17 |
|
I have an onsite tomorrow, they asked me to build a simple app. I want to style the hell out of it with their logo/colors/fonts. Would that appear too overeager or presumptive in a candidate?
|
# ? May 24, 2016 04:26 |
|
Raskolnikov2089 posted:I have an onsite tomorrow, they asked me to build a simple app. I want to style the hell out of it with their logo/colors/fonts. Would that appear too overeager or presumptive in a candidate?
|
# ? May 24, 2016 04:29 |
|
Raskolnikov2089 posted:I have an onsite tomorrow, they asked me to build a simple app. I want to style the hell out of it with their logo/colors/fonts. Would that appear too overeager or presumptive in a candidate? Make it pretty, but I wouldn't use the company logo or colors
|
# ? May 24, 2016 11:47 |
|
Can anyone explain isomorphic JS to me in a way that doesn't make me want to stab the nearest living thing AND doesn't make it sound like it's just bullshit papering over the limitations of SPAs? Thanks.
|
# ? May 25, 2016 22:17 |
|
For the first load, rather than sending a template over, then letting the client hit the API and render before they can see their data, take the template and the data the API would've provided and render it server side. This is easier if you're using the exact same template code, that's the isomorphic js, just a fancy way of saying used by server and client alike. This is used to make the first render fast usually, that's all.
|
# ? May 25, 2016 22:31 |
|
Maluco Marinero posted:For the first load, rather than sending a template over, then letting the client hit the API and render before they can see their data, take the template and the data the API would've provided and render it server side. This is easier if you're using the exact same template code, that's the isomorphic js, just a fancy way of saying used by server and client alike. This is used to make the first render fast usually, that's all.
|
# ? May 25, 2016 22:44 |
|
Well, the SEO benefits are good if you can respond with an exact render of public pages within milliseconds. A SPA with public pages can benefit greatly from cached server side renders.
|
# ? May 25, 2016 22:55 |
|
vardyparty posted:Semicolons or no semicolons? I had someone say this to me in an interview. Also about not using { } with if / else statements. He wasn't hired. Strong Sauce posted:Adding semicolons won't help someone in this case. Learning how ASI is implemented will. Yeah you're example is kind of tricky because to someone new to programming might not realize that an object is just an array of a map (key/value pair) so a comma would be used in that case (if there were more k/v pairs after). quote:The answer should be choose whatever works best for you. If you're writing code just for you - do whatever you want. I personally think it's lazy and in poor practice not to use them. I've always been strict with semi-colons; I'm from a Java background, so it's just more natural to me. In a team environment they should be enforced so there's less possible misinterpretation. At my company your code will not pass peer review. The time it can take to submit, reject, resubmit fixed code takes up more time than just using a semi-colon.
|
# ? May 26, 2016 00:23 |
|
geeves posted:Yeah you're example is kind of tricky because to someone new to programming might not realize that an object is just an array of a map (key/value pair) so a comma would be used in that case (if there were more k/v pairs after). I don't think that's the problem Strong Sauce was alluding to.
|
# ? May 26, 2016 04:01 |
|
Horn posted:Is there a proper name for what I'm doing to do here with runUpdates? Basically I'm looking to pass in an initial state and some list of updaters to modify that state without having to do something like updateSomeVal(updatemyThing(state)) as that gets ugly pretty quickly. Sounds like you're reduceing the array of functions, to me. (Prefer passing explicit arrays instead of using variadic functions, IMO.)
|
# ? May 26, 2016 14:30 |
|
Jabor posted:I don't think that's the problem Strong Sauce was alluding to. JavaScript claims another skull for its throne. The function returns undefined
|
# ? May 26, 2016 20:51 |
|
Vulture Culture posted:It's important to note that this is really only useful for incremental/progressive rendering. If you're going to render the whole dataset up front, there's usually few benefits (SEO?) versus batching your DOM updates. Google is activating script tags now. Thanks to the many who have answered my questions in this thread throughout the years as I learned how to program. Just scored my first front end gig at an agency for what seems to me an ungodly amount of money. I'm sure they'll work me like a dog, but I'm going to learn a lot.
|
# ? May 27, 2016 02:13 |
|
Raskolnikov2089 posted:Google is activating script tags now. I think Google might ration how much time they spend crawling a site. Pre-digesting your JS into HTML might mean they crawl your site more thoroughly or frequently. Or not. I'm not an SEO guy.
|
# ? May 27, 2016 02:22 |
|
Can someone point me in the right direction with parsing text or html files grabbed with jQuery? The data I need is contained within the first <script> tag on various servers within my local network at work. Eg code:
So far I've got this, to read in a list of IPs and request the right page: code:
Edit: IPs.txt is formatted as like IPs = [ "Address here" ]; That'll work, right? thehustler fucked around with this message at 18:39 on May 29, 2016 |
# ? May 29, 2016 18:34 |
|
thehustler posted:Can someone point me in the right direction with parsing text or html files grabbed with jQuery? The data I need is contained within the first <script> tag on various servers within my local network at work. I haven't used it myself, but this seems like the kind of thing phantomjs was built for. http://phantomjs.org/ Check out this project: http://nrabinowitz.github.io/pjscrape/
|
# ? May 29, 2016 19:29 |
|
i am pretty sure ALL of those ips also need Access-Control-Allow-Origin headers for you to be able to read anything on them in a browser
Impotence fucked around with this message at 20:00 on May 29, 2016 |
# ? May 29, 2016 19:57 |
|
Really? I did wonder about that. They are all on the same LAN but different servers. They are actually AV control panels. I wonder what web server they run and whether I can add that.
|
# ? May 29, 2016 20:07 |
|
If you're just making a tool for your own use, you can probably make a greasemonkey script and use its GM_xmlhttpRequest to make cross-origin requests
|
# ? May 29, 2016 20:15 |
|
Biowarfare posted:i am pretty sure ALL of those ips also need Access-Control-Allow-Origin headers for you to be able to read anything on them in a browser No, script tags work cross-origin. E: nm, misunderstood
|
# ? May 29, 2016 20:48 |
|
Aye guys you were right cross-domain blocked. And as far as I can see there's no way I change things on the server, given what kind of devices they are. I may well contact the manufacturer but if it's some cut down httpd I guess it'll be hard to do. Any way I can determine what the web server is on the devices? Will it be in some headers when I request a page from them? This is supposed to be a simple internal solution for something, not sure I want to start running PHP/proxy stuff everywhere for it. A webpage to sit on a shared drive that can be called up as and when needed that will contact each projector/AV panel and read the data. Looks like I may need another solution... Edit: Hah, I did push the page to the device's web server and when I called it from there everything worked perfectly. Which is a bit of a punch in the face really thehustler fucked around with this message at 11:58 on May 30, 2016 |
# ? May 30, 2016 09:00 |
|
Wait a minute. All the panels are in DHCP/DNS so I guess I could use document.domain couldn't I? And set it to the main host name? This is only going to run internally on the LAN. Not even reachable on the VPN. Are there any security concerns if I do it? Will that even work?
|
# ? May 30, 2016 21:53 |
|
if you control the browser you can force disable CORS on the browser end (or just proxy the poo poo through your server)
|
# ? May 31, 2016 03:45 |
|
Or set up a proxy that always adds the header
|
# ? May 31, 2016 20:03 |
|
https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi There's a number of browser add-ins that will ignore the CORS stuff.
|
# ? May 31, 2016 20:11 |
|
I cannot remember if it still works but add a desktop shortcut to Chrome with "--disable-web-security" on the command line. Don't forget the OPTIONS pre-flight request if using a proxy, e.g. code:
code:
MrMoo fucked around with this message at 21:03 on May 31, 2016 |
# ? May 31, 2016 20:55 |
|
I am in npm hell. I'm trying to add a module called "reddcore" to my browser project. The module's github is here: https://github.com/reddcoin-project/reddcore When I follow the instructions to build a browser bundle, it all works fine, except when I try to do reddcore = require("reddcore") it just says "require is not defined" The browser bundle gets built, and it looks like it works, but it just doesn't. I can't look through the source code because the generated source code is minified and completely unreadable. How can I debug this?
|
# ? May 31, 2016 22:32 |
|
School of How posted:I am in npm hell. I'm trying to add a module called "reddcore" to my browser project. The module's github is here: https://github.com/reddcoin-project/reddcore In general, you do not (yet) use require in browsers (unless you are using something like webpack or browserify). I'm not sure if the bundle itself provides a require polyfill, but are you sure you have loaded the bundle.js before you try your code?
|
# ? Jun 1, 2016 00:37 |
|
Skandranon posted:In general, you do not (yet) use require in browsers (unless you are using something like webpack or browserify. I don't think you'll ever use require in browsers since ES2015 introduced import and friends...right?
|
# ? Jun 1, 2016 01:28 |
|
Skandranon posted:In general, you do not (yet) use require in browsers (unless you are using something like webpack or browserify). I'm not sure if the bundle itself provides a require polyfill, but are you sure you have loaded the bundle.js before you try your code? This bundle.js was generated by browserify... I'm positive the file is being embeded in the page. The contents of bundle.js look like this: code:
By the way, the require line was taken directly from that lib's documentation page. I've also seen other node projects use require in the browser like that too.
|
# ? Jun 1, 2016 07:47 |
|
Thermopyle posted:I don't think you'll ever use require in browsers since ES2015 introduced import and friends...right? browsers will eventually support import but it isn't implemented in the browsers (nor node) yet. the spec added them but never explained how they would be implemented and now they realize their mistake so a lot of it is being delayed.
|
# ? Jun 1, 2016 09:23 |
|
Thanks for the help guys, getting closer. Would love to do this without modifying my colleagues' browsers or whatever but if that's the only way it'll have to do. Any idea why this is whining at me? code:
It seems to whine after the split and I don't know why. Do I need to escape that ; in the split or something?
|
# ? Jun 1, 2016 12:54 |
|
You're trying to reference a key in a variable at the same time you're declaring it with var. If projname and projlamphrs already exist, just use:code:
|
# ? Jun 1, 2016 13:29 |
|
|
# ? May 15, 2024 03:57 |
|
MrMoo posted:I cannot remember if it still works but add a desktop shortcut to Chrome with "--disable-web-security" on the command line. Please, no. This is super dangerous. If you accidentally end up browsing the internet with that flag set you are incredibly vulnerable. The flag's name is not overstated.
|
# ? Jun 1, 2016 13:39 |