|
https://twitter.com/etiene_d/status/745218992319639552 A Chrome-only bug tied to let. Pretty funny.
|
# ? Jun 23, 2016 09:00 |
|
|
# ? May 23, 2024 10:14 |
|
Strong Sauce posted:https://twitter.com/etiene_d/status/745218992319639552
|
# ? Jun 23, 2016 10:05 |
|
Strong Sauce posted:https://twitter.com/etiene_d/status/745218992319639552 lol let is dumb anyway
|
# ? Jun 23, 2016 14:25 |
|
Kekekela posted:Optimizer related I guess? Yes. https://www.reddit.com/r/javascript/comments/4oxtgk/javascript_developers_be_warned_about_this_crazy/ https://bugs.chromium.org/p/chromium/issues/detail?id=604033 https://github.com/v8/v8/commit/7dfb5beeec8821521beeb2b8eac36707a663064c
|
# ? Jun 23, 2016 14:57 |
|
I couldn't figure out how to phrase this for Google so maybe ya'll can help me out. In the React.js pattern of passing a "callback" as props from parents to their children, how do you retain access to both the parent AND child scope inside the callback? Or rather, is there an elegant way to do it? Example: code:
The most straightforward solution that I've arrived at is to simply pass the parent itself to the child as a prop, but that feels bad in a way I can't really articulate and results in lovely looking code.
|
# ? Jun 23, 2016 19:29 |
|
If you need to deal with data at the Button level that can't somehow be derived at the App level, you could have a internal event handler in Button that calls the callback:code:
Depressing Box fucked around with this message at 21:03 on Jun 23, 2016 |
# ? Jun 23, 2016 20:58 |
|
The problem with your solution is that I need access to App's setState method, which I can't do if I bind the scope to Button, and the internalButtonData that I want to send to the callback is Button's internal state. Here's a more detailed and specific picture of what I'm trying to do:code:
As I mentioned I've already "solved" the problem by passing List to each Entry but There's Got To Be a Better Way!
|
# ? Jun 23, 2016 21:37 |
|
I solved a similar problem with something along these lines:code:
EDIT: An example with a curried move handler: code:
Depressing Box fucked around with this message at 22:47 on Jun 23, 2016 |
# ? Jun 23, 2016 22:35 |
|
edit: whoops, refreshed and there's more! Yeah, what Depressing Box just posted is the correct way. Your parent should never know about the children state, and vice versa. The idea is to make testing _easier_, not harder.
|
# ? Jun 23, 2016 22:47 |
|
Ugh yeah it seems so obvious now. Bind the both the Entry and List event handlers to themselves and then call one from the other. A valuable lesson in managing code:
|
# ? Jun 23, 2016 23:21 |
|
I am building a checklist on Google Sheets for work. The idea is that it will be a template that anyone at my company can open, so that they have this checklist to work through for each of their clients. This was based on the To Do template that Google supplies, which had the cool idea of having a conditional format where if there is anything entered into the check column, that column and the task column are colored gray and are struck out. Very cool. I want to have it so that anything entered into a cell on the checkmark column is replaced with a check symbol. I believe I should be able to do this using script.google.com, which is Javascript. I found this code: code:
Even if I didn't have this error, the code is incomplete for my needs. I'd need to tell the script to only watch a certain column. And right now it is only looking for a "/" value. I'm not sure how to change it so that it would go off any value.
|
# ? Jun 24, 2016 17:03 |
|
The first thing that I noticed is your code is using curly quotes (“ and ”) instead of regular quotes ("), which would cause the "illegal character" error.
|
# ? Jun 24, 2016 17:28 |
|
Depressing Box posted:The first thing that I noticed is your code is using curly quotes (“ and ”) instead of regular quotes ("), which would cause the "illegal character" error. The perils of using Word as your IDE.
|
# ? Jun 24, 2016 17:38 |
|
Ok, I put together a simple sanitization script. Note that this is very brittle, and will occasionally miss things like rapid changes or values copied from other cells. You'll probably need to tweak this for your specific setup. First, go to the sheet's script editor: Paste in this script: code:
And there you go: EDIT: Here's are some relevant links from Google's documentation:
Depressing Box fucked around with this message at 19:00 on Jun 24, 2016 |
# ? Jun 24, 2016 18:46 |
|
Oh jeez, that was it. I also posted this on stack overflow, and I was suggested this code: code:
Depressing Box posted:Ok, I put together a simple sanitization script. But this script works perfectly. Thanks! Do you have any objects to me posting this in my stack overflow post?
|
# ? Jun 24, 2016 18:54 |
|
No objects, go nuts.
|
# ? Jun 24, 2016 19:02 |
|
Mozilla just renamed String.prototype.contains to includes, just in case you have been using that and something is suddenly broken. Edit: They renamed it a couple of years ago, but removed the old function just now Wheany fucked around with this message at 20:35 on Jun 26, 2016 |
# ? Jun 26, 2016 20:31 |
|
Wheany posted:Mozilla just renamed String.prototype.contains to includes, just in case you have been using that and something is suddenly broken. I'm sure I have some old production code that that breaks, but I don't work for those people anymore, sooooooo
|
# ? Jun 27, 2016 18:03 |
|
I need to run a form submit, locally, but not using a local webserver. On my form, a user will select a csv file from their directory, input a title, then click submit. The form should read values from the csv file, spit them out on the page as well as the form title. I can't use a webserver, or a local webserver. Is this possible, even with ajax? I tried googling to read a csv file, but im getting an empty array. Any help is appreciated.
|
# ? Jun 30, 2016 16:17 |
|
You'll want to use a FileReader. This should be able to start you off: http://www.html5rocks.com/en/tutorials/file/dndfiles/
|
# ? Jun 30, 2016 16:22 |
|
stoops posted:I need to run a form submit, locally, but not using a local webserver. A quick search turned up Papa Parse, which looks promising. It can parse CSV data directly in the browser, including local and remote files.
|
# ? Jun 30, 2016 16:26 |
|
Thanks guys, I have something working right now based on your suggestions Now, I have a different problem. Okay, so my studentData variable has to be set like this: code:
code:
|
# ? Jun 30, 2016 18:54 |
|
stoops posted:Thanks guys, I have something working right now based on your suggestions I think you might want to look into how you are generating / reading it in rather than looking at removing the quotes, as that seem to be the better problem to solve.
|
# ? Jun 30, 2016 19:02 |
|
stoops posted:Thanks guys, I have something working right now based on your suggestions Could you elaborate on how you are generating the data?
|
# ? Jun 30, 2016 19:02 |
|
Yeah, i know i'm doing it wrong, i just wasnt sure how to put it in the correct array. I'm using this site to read a csv file. http://evanplaice.github.io/jquery-csv/examples/basic-usage.html this is the code that reads my csv and spits out a variable code:
this is how i thought I could put it in the studentData variable. code:
I appreciate the help.
|
# ? Jun 30, 2016 19:23 |
|
stoops posted:Yeah, i know i'm doing it wrong, i just wasnt sure how to put it in the correct array. I'm using this site to read a csv file. It's pretty simple then... you are building a string. You just need to parse it back into an object with JSON.parse() . However, if data[row] is your actual data, and not strings, you could skip that step entirely and just do studentData.push(data[row]).
|
# ? Jun 30, 2016 19:27 |
|
Skandranon posted:It's pretty simple then... you are building a string. You just need to parse it back into an object with JSON.parse() . However, if data[row] is your actual data, and not strings, you could skip that step entirely and just do studentData.push(data[row]). I"m having trouble with the parsing. I'm just not getting it. I'm getting an error of code:
|
# ? Jun 30, 2016 20:06 |
|
Isn't the result of $.csv.toArrays(input) exactly what you want for studentData? I don't think you need to do anything else if you want it as an array of rows and each row is an array of columns.
|
# ? Jun 30, 2016 20:10 |
|
necrotic posted:Isn't the result of $.csv.toArrays(input) exactly what you want for studentData? I don't think you need to do anything else if you want it as an array of rows and each row is an array of columns. I thought so, but, the way the data is coming in is like this, (from the console). code:
What does work is when my values come in as code:
Just can't figure it out.
|
# ? Jun 30, 2016 20:25 |
|
JavaScript code:
|
# ? Jun 30, 2016 20:34 |
|
Or do that ^
Infected Mushroom fucked around with this message at 20:42 on Jun 30, 2016 |
# ? Jun 30, 2016 20:38 |
|
Munkeymon posted:
That worked, phew. THANK YOU!
|
# ? Jun 30, 2016 20:48 |
|
stoops posted:That worked, phew. THANK YOU! Yeah, CSV doesn't encode types so everything is a string. I'm surprised whatever graphing lib didn't handle the coercion for you, though the parseInt approach is definitely better. You can also use map so you don't have to loop yourself: code:
|
# ? Jun 30, 2016 21:37 |
|
I have a 2D array with objects and properties. Does anyone know why setting one property at a certain index would set EVERY index with that property? I've checked over and over the validity of the indexes and logged the object just fine. I do something like: roomArr[currentRoom.x][currentRoom.y].wallUp.icon = 'icons:check-box-outline-blank'; and it sets every "wallUp" property to every index to that icon. It's not going through a loop.
|
# ? Jul 1, 2016 17:47 |
|
How are you setting wallUp? Sounds like you're creating that object once and using it for every item in your array.
|
# ? Jul 1, 2016 17:58 |
|
Horn posted:How are you setting wallUp? Sounds like you're creating that object once and using it for every item in your array. Yeah, that sounds about right. You need to either set each wallUp = {x : 1, y: 2, z: 3}, or use a cloning method to ensure they are in fact separate objects.
|
# ? Jul 1, 2016 18:07 |
|
Horn posted:How are you setting wallUp? Sounds like you're creating that object once and using it for every item in your array. I'm setting it up with a loop. I know it's fine then. I can check it and see that the objects are different. It's when I change it like in my post above that every object at every index changes. So to be more clear: code:
LP0 ON FIRE fucked around with this message at 18:17 on Jul 1, 2016 |
# ? Jul 1, 2016 18:11 |
|
LP0 ON FIRE posted:I'm setting it up with a loop. I know it's fine then. I can check it and see that the objects are different. It's when I change it like in my post above that every object at every index changes. The problem is not with the loop, it's that if you do something like below, all the rooms just have pointers to the SAME, single wallUp object that was created, and thus, changing a thing on any of them is going to change it for all of them, as all rooms share a single wallUp object. code:
code:
|
# ? Jul 1, 2016 18:16 |
|
Looks like that's what I'm doing. Thank you!
|
# ? Jul 1, 2016 18:19 |
|
|
# ? May 23, 2024 10:14 |
|
Is it okay to ask React questions here? I'm not totally grasping a concept and want to figure this out. A checkbox group can have a parent, global, checkbox that propagates its state to all children. If one of the children is un-checked then the parent should also be. I have two groups of checkboxes and can un-check them all when I un-check the parent, but can't seem to grasp how to get them all checked initially (on the first click) within the same call to this.setState -- the tutorial and documentation have basically gotten me this far: https://jsfiddle.net/x0b1Lzc4/1/ but I don't feel that I'm doing this the React way.
|
# ? Jul 1, 2016 21:52 |