« first day (2308 days earlier)      last day (2658 days later) » 

4:04 PM
@Thaenor Some people encode font in base64 for the same reason that some people think minifying javascript is a form of protection.
 
@rlemon sinus infection?
that's going around here, and my teeth always hurt when i get a sinus infection
 
nahh, just sensitive today for some reason
normally they are not
 
Hey, I've got a question about writing a test in Mocha
I've got a function to test that looks like this:
function toTest(asyncFunctionUsingPromises) {
  asyncFunctionUsingPromises()
  .then((result) => {
    if(result === 'something bad') {
      throw new Error();
    }
  });
}
 
user2620028
holy crap.... i didn't realize it was so hard to get es6 import working outside of node
 
user2620028
it really isn't that hard now that i know what to do... but yeah
 
4:14 PM
The function calls another function that returns a Promise, and then, in the then block, throws an Error in certain situations
I want to write a test that makes sure the error is thrown
I tried this:
 
i'm off for an extended weekend. cya
 
it('should throw an error when something bad', (done) => {
  const mockFunction = () => {
    return new Promise((resolve) => { resolve('something bad'); });
  };
  try {
    toTest(mockFunction);
    setTimeout(() => {
      done('should have thrown an error');
    }, 20 /* a short wait to let the Promise resolve and the then block run */);
  } catch (error) {
    done(); // The error was thrown, yay!
  }
});
But the test fails with the done('should have thrown an error'); line, even though the error is being thrown
I think it's because the setTimeout block will run whether the error is thrown or not
What would be the right way to write this test?
 
@HatterisMad Browsers used to implement experimental spec quickly... and the result is mixed at best. With node, you control the code and the server, so if you don't update you don't break old code, but browser is another world. Since import has now finalised, the browsers are implementing it.
 
@Kevin Why aren't you catching it in a promise catch block?
 
user2620028
@Sheepy uhhh cool?
 
4:23 PM
Is this something like this: 'asdg@gmail' a valid email?
 
I'm following this regex and it seems like it's a valid email! I wonder why?
const EMAIL_REGEXP =
            /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;
 
@BenFortune The error isn't being thrown from within the Promise, it's thrown from within the then block. Would I still use a catch block for that?
Reading this, it looks like you're probably right: jamesknelson.com/are-es6-promises-swallowing-your-errors
 
@Kevin With mocha you can return to the test and it should catch it
 
@Euridice01 it may be valid in some contexts ("discouraged" by ICANN but valid)
 
4:27 PM
@Euridice01 no
 
@BenFortune I'm not testing the function that returns the Promise, I'm testing the function that handles the Promise. By the time the function under test returns, the Promise has already been "consumed."
 
const regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/g;
 
@Euridice01 yes
 
Yeah, adding a catch block to my function and testing that the catch block was run got my test working again
Thanks!
 
4:32 PM
@Kevin But promises can be chained, if you throw from that, you can catch it in the next chain
 
so it's not valid?
I'm trying to use this new regex but it says it's invalid:
const EMAIL_REGEXP = /^(?("")("".+?(?<!\\)""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]*\.)+[A-Za-z0-9][\-a-zA-Z0-9]{0,22}[A-Za-z0-9]))$/;
 
@Euridice01 100% unnecessary
Also for above, if your server sends emails as something like ben@localhost like mine does.
 
I don't want to allow emails ben@localhost
My company wants ben@localhost.com
must have a period
:/
 
did you read the post denys linked to?
 
yes sadly my company doesn't care
They already have one for their backend service
 
4:41 PM
My email checking regexes are just /@/. You may want to add the dot but you shouldn't make it much more complex
 
and they're like just use the same one
 
just use /.+@.+\..+/
 
this is what they use on their backend:
 internal const string EmailValidationPattern =
        @"^(?("")("".+?(?<!\\)""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))" +
        @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]*\.)+[A-Za-z0-9][\-a-zA-Z0-9]{0,22}[A-Za-z0-9]))$";
 
user2620028
honestly i dont even validate client side
 
Now I have to use it for client side
 
4:42 PM
Use it, then
 
so I need to fix it to be valid for js
Looks like I need to escape some characters
 
what is a web font?
Does it have anything to do with loading fonts through a cdn?
 
I tried this:
 const EMAIL_REGEXP = /^(\?("")("".+\?(\?<!\\)""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(\?<=[0-9a-zA-Z])@))(\?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]*\.)+[A-Za-z0-9][\-a-zA-Z0-9]{0,22}[A-Za-z0-9]))$/;
But it doesn't match anything right now
 
@Thaenor it's what Spider-man uses on his letterhead :)
 
so I probably escaped the wrong characters XD
 
4:44 PM
@Luggage so where are we meeting again?
 
@SterlingArcher you are missing a hellovalot!
 
got me. will decide when i get down there
 
charlotte's web
 
or you can
 
4:45 PM
Do you mind coming to WeLive :D ?
It's right on the road
quite literally next-door!
 
@Euridice01 You have bigger problems than just escaping. Standard js regexes don't support lookbehind. You'll have to understand that stupid regex to write a new one.
 
@Luggage ^
 
If I have two react components and I want to use one of them inside the other how do I import it for use? or am I doing this wrong?
 
quite literally
 
import Component from './component.jsx';
?
 
4:50 PM
import SecondComponent from './SecondComponent';
 
Ahh I must be having a different issue
 
what is it?
 
What is what?
 
love
 
I'm doing that at the moment and it keeps telling me it can't find the reference
 
4:51 PM
@lix check the path
 
Love!
 
"we live"
 
the place where I live
 
0
Q: How to generate dynamic dropdowns based on user input in php/javascript?

rangerThis code below is the code that I want to convert into like when a user inputs a number in a text box and click set, dynamic dropdown (code below) appears based on the number inputed in the textbox. if($question !=""){ $query=mysqli_query($con, "SELECT * FROM question WHERE quest...

 
its a co-living space owned by "WeWork"
 
4:52 PM
Guys T_T
 
ohh, gotcha. sure.
 
Ok then :)
 
import React from "react";
import NewsPane from '/NewsPane.jsx';

export default class HomePane extends React.Component {
    render() {
        return (
         <div className="row home-pane-panel">
            <h1>Hello</h1>
            <NewsPane />
         </div>
        );
    }
};
 
you need a .
/ !== ./
 
wow
 
4:53 PM
driving and won't always see here, so hangouts chat me if you need my attention
 
ok :o
 
ugh
thanks @rlemon
 
i'm not moving at the moment.. :)
 
so I have a column in my table named "Offset" (yes yes I know, I don't control this tho)
UPDATE table
SET table.Offset = 123
WHERE id = 'id'
is not working. (postgres)
'column table of relation table doesn't exist'
 
4:55 PM
Excuse me I'm currently trying to code a survey system. My database design is currently set as category > subcategory > topic> question. I mean there's sub category under a category, there's topic under a subcategory, and there's questions under topic.
Atm I'm on the creation survey part and so far I have three dynamic dropdowns that if I choose a category on the first dropdown, the second dropdown will display the sub categories under that category that I picked on the first. Then the third dropdown displays the topics under the subcategory I picked on the second dropdown
Like I said I still have questions under topic but its not coded yet but the database relations are all okay
What I'm trying to do now is generate dynamic dropdowns based on user input in php/javascript
those dropdowns will display
 
!!afk lunchin
 
under the topic
the question
Can you help? T_T
-2
Q: How to generate dynamic dropdowns based on user input in php/javascript?

rangerThis code below is the code that I want to convert into like when a user inputs a number in a text box and click set, dynamic dropdown (code below) appears based on the number inputed in the textbox. if($question !=""){ $query=mysqli_query($con, "SELECT * FROM question WHERE quest...

 
@SterlingArcher I'm touched by this post chat.stackoverflow.com/transcript/message/34044145#34044145
its not a good idea but I'm touched still just saw it for some reason
 
@bluefeet Could I get you to take a look at a MySQL query for me?
 
This is the dynamic dropdown that I want to display depending on the number of user input in a textbox. For example I typed 10 and set, 10 of these dropdowns will appear.
 
5:04 PM
1 message moved to Trash can
@ranger Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
@ranger maybe
 
 if($question !=""){

            $query=mysqli_query($con, "SELECT * FROM question WHERE question_topic = $question ");
            echo "<select>";
            echo " <option>--None Selected--</option>";
            while($row=mysqli_fetch_array($query))
            {
                echo "<option value='$row[question_id]' selected>"; echo $row["questiontitle"]; echo "</option>";
            }
            echo "</select>";
        }
Sorry
But yeah
This is the dynamic dropdown that I want to display depending on the number of user input in a textbox. For example I typed 10 and set, 10 of these dropdowns will appear.
This already displays the question under a certain topic i picked. i just need to have that option that i mentioned above
sir i edited my post with more info
-3
Q: How to generate dynamic dropdowns based on user input in php/javascript?

rangerThis code below I'm currently trying to code a survey system. My database design is currently set as category > subcategory > topic> question. I mean there's sub category under a category, there's topic under a subcategory, and there's questions under topic. Atm I'm on the creation survey part an...

 
@ranger nice xss
 
I don
 
He don's the cap of XSS
 
5:18 PM
I don't have design yet sir just trying toget the whole process to work first :( @Meredith
Guyss :(
 
@ranger use PDO
 
user2620028
or at the very least prepared queries
 
The only code that I need is the javascript for the generating of the dropdowns right?
 
why do you need javascript?
you mean a change event or something?
 
Yes coz all those 4 dropdowns are working already, all I need is like a text box and a button set
that If I enter 4
4 dropdowns will appear
if($question !=""){

            $query=mysqli_query($con, "SELECT * FROM question WHERE question_topic = $question ");
            echo "<select>";
            echo " <option>--None Selected--</option>";
            while($row=mysqli_fetch_array($query))
            {
                echo "<option value='$row[question_id]' selected>"; echo $row["questiontitle"]; echo "</option>";
            }
            echo "</select>";
        }
with that code
each of thoes dropdowns will display that ^
 
5:31 PM
can I use promises (js) in load&execution script by script
?
 
I wrote some func and promises but my code isn't synchronous.. :P
 
Is it worth knowing ES6 before learning React?
 
@Munkie it helps
 
I mean if you know es5, es6 takes like 5 minutes to learn
 
5:34 PM
in reality you will be learning es6 as you learn react
since the majority of examples/code use es6 anyway
 
Would I pick it up on the way? I have a course from Wesbos, a couple of hours about ES6. Should I do that or just wing ES6 as I write React?
 
Just wing it
 
@jake out of all the options in this article zachleat.com/web/comprehensive-webfonts - which do you recomend?
This question is extensive to the good folks all over the chat as well :D
 
@font-face {
  font-family: 'Proxima Nova';
  src: url('/app/shared/fonts/proximanova-bold.woff2') format('woff2'),
  url('/app/shared/fonts/proximanova-bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
}
@Thaenor That is what we use. Simple enough.
 
Does anyone find a moment to give me small favor?

I'll be grateful :P
 
5:42 PM
body {
  font-family: "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif;
etc...
 
font-family: cursive
 
$('body').addClass('fa-spin')
 
@jake this is what the article calls the uncerimonious font face
right?
 
Yes, the font will get cached, in the end, its not worth doing anything crazy to start with.
I find that when I start looking too hard at all of the options, I am really just procrastinating because of all of the other stuff I have to do.
 
What i do wrong, that second script no wait for execution first script?

My example: https://jsfiddle.net/onpaoquf/
@Luggage I use promises as you said :)
but code from next promises still no wait for execution previous script..
 
5:56 PM
dying
 
Lol
 

« first day (2308 days earlier)      last day (2658 days later) »