« first day (3023 days earlier)      last day (2150 days later) » 
00:00 - 19:0019:00 - 23:00

00:04
o/
Quick question
How would you saved a complete html element (child included) with his / their event attached
(The idea is to store it in localStorage)
What what ?
Let say I have
<div id="parent">
   <span onclick=wtv>WTV</span>
</div>
How would you do to save the integralite
(Actually the eventHandler is add post rendering and not as an attribute of the tag)
00:07
Is this an XY question
What's an integralite
Frenchisme
In it's whole
oh. much clearer
And no this is not an XY question
I'm just asking if you've got an idea
save... Where?
00:14
In the localStorage
My question is
Is there a way to select it which will keep the event attached to his children within the localStorage
Well what is the "event"? Saving arbitrary code requires arbitrary solutions, it's not often good to use a generic solution.
The generic solution is to transform the component into JSON and store that.
But that just moves the problem from "saving" to "transform to JSON".
This is what I was expecting
Its multiple onclick event for example
Well the problem with saving that is that you also open up a whole lot of cans of potential leaks.
if you save the function called in onClick, say as "name" of the function. Then later execute that based on the "name", you've opened a new attack vector: a harmful third party could try to modify the localstorage beloning to your site: and modify that onclick event to harmfull_functon. (instead of wtv).
If you make it more generic and allow anything, thus also arbitrary inline js in the onclick event it's even more damaging.
This is an important tough I do agree
But this project is not exactly suppose to see the world
Thus the "solution" will always have to be a solution build for the specific purpose.
00:22
I'm trying out something but I'm 80% sure it will fail :(
Well in that case: how would you store any hierarchical data?
Explaining that is more than I could do here though
01:08
Me again
So after a tones of test
I'm allways ending up with
[object MouseEvent]
When I try to console.log my item soterd in localStorage
Any clue on how to avoid this ?
Or this
Object { isTrusted: true }
The last version is when I try to JSON.stringify my click object
Yes that's because JSON.stringify will remove all functions. As said you'd have to make your own custom dictionary from that click object and then "stringify" that.
Ho gosh
I missed that part
:/
Well you just made me save a loooot of time !
Thank you sire
01:28
How could I set a default value to an optional in TypeScript? I have a context.auth.uid property that is optional, and I want to assign it's value to another property but if it is undefined I want it to have a default value, is that possible?
As in ||?
Problem is that auth us optional too
ah, null coalescing
waaa? Promise.all doesn't work with an array of async functions? :/
I think null coalescing is considered for future versions but it's not standard as of yet. (Don't quote me on that)
@towc Of course not, it expects an array of promises
01:30
oh, right, I need to call the async functions
const nullable_property = 0;
const val = nullable_property || 100;
//val = 100 now even though it was not null/undefined before.
That is why I really dislike the advice of using || to set default values.
Yeah, unfortunately there's nothing quite as nice as C#'s ??
you could write your code in coffeescript
i think babel supports it
or webpack directly
@KendallFrey What would be a "clean" way to get uid?
As far as I know the only way is to have a chain of undefined checks
if (context !== undefined && context.auth !== undefined &&  context.auth.uid !== undefined) ...
01:37
Something like this:

let userID: string

if (context.auth !== undefined) {
    if (context.auth.uid !== undefined) {
        userID = context.auth.uid
    }
}
else {
    userID = "undefined"
}
@JonathanSolorzano 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
You can use && and the fact it's short circuited
Oh, you've broken the else
Use &&
if (context.auth && context.auth.uid !== undefined) {
    ...
} else {
    ....
}
01:40
Indeed still not as nice as
So, just to be clear
There's no cleaner way to write this:
userId = context?.auth?.uid;
if (context.auth !== undefined && context.auth.uid !== undefined) userID = context.auth.uid
        else userID = "undefined"
You don't need the !== undefined if you know the value will be a string or an object (which you do know for context.auth)
You could use a library? Or are you trying to avoid them?
01:42
Hmm does anyone know a js derived language (superlanguage like ts or something similar) that allows for operator overloading as well as the inclusion of new operators?
@paul23 Then would this would be correct:
if (context.auth && context.auth.uid) userID = context.auth.uid
else userID = "undefined"
?
Yeah I think that's ok
if context.auth.uid isn't a number - yes
@WilliamLee Trying to avoid them
Or anything else that could be falsy
01:44
btw I would disrecommend setting a string to "undefined" literal for "bad input".. Unless you print the string directly to the user I'd just use "" or actually set it to undefined
02:01
How can I show the same mnemonic code in two pages in my React Native app? I am generating mnemonic code and I want to show it in two pages. These two pages have a component for each and they are siblings.
posted on January 25, 2019 by Myles Borins

Notable Changes events: For unhandled error events with an argument that is not an Error object, the resulting exeption will have more information about the argument. nodejs/node#25621 child_process: When the maxBuffer option is passed, stdout and stderr will be truncated rather than unavailable in case of an error. nodejs/node#24951 policy: Experimental support for module integrity checks

user1596138
02:16
@DavidKamer I did
user1596138
@paul23 The uid can't be valid as zero anyway.
user1596138
So even if it's a number, yep, no problem
huh how you know that?
user1596138
Because nobody uses 0 as a UID
user1596138
THAT would be the edge case haha
user1596138
02:19
Idk. I'm over it today
O?
My id's typically just go from 0 to the number I'm currently using
In linux user-id-zero (UID == 0) is actually always defined as root for example.
user1596138
2 mins ago, by Jhawins
Idk. I'm over it today
If I have

metadata?: {
[key: string]: string;
};

Why does `const uid = object.metadata?['uid']` expect `:` after it?
@JonathanSolorzano Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
Because that is not javascript syntax?
The question mark would indicate you're doing a ternary operation.. So basically it reads as:
let uid;
if (object.metadata) {
    uid = ['uid'];
} else {
    ..... not used
}
you have to specify the "else" in the ternary operator.
02:30
to add to what @paul23 said, a ternary that it thinks you're doing is in this format:

const variable = boolean ? result1 : result2;
I don't know why it won't format that...
const variable = boolean ? result1 : result2;
backticks for inline code, it isn't capable of combining "text" and "multiline code" in the same message though
yea
did that
then it didn't work when on a new line for some reason
so I did 4 spaces in... still didn't work
meanwhile you pinged me a dozen times :P
sorry...
I forgot about that "feature"
that's probably actually a bug... someone needs to tell SO that if you edit something it shouldn't ping people or only ping the first time
03:25
@paul23 I was not using a ternary operator
@paul23 What I wanted was to get the 'uid' property
Then what is that question mark doing there?
?
@KevinB I can't remember if it is JavaScript... I vaguely remember question marks being used in querying objects in either a newer JS standard or some language like Rust?
03:41
ruby uses them
Yeah I was using ruby recently so that was probably it. Thanks @david
@JonathanSolorzano do you use ruby?
04:08
Only const uid = object.metadata?['uid'] was the code part
That code expects a : after it
@DavidKamer I didn't wanted to mean a ternary operator when I wrote the message
@JonathanSolorzano JavaScript sees a ternary operator anyway, just like a parenthesis is always a parenthesis
if you remove the ? it would work
unless you're using documentation that tells you to do it that way, and in that case, can you share it?
It's not js, its typescript
@JonathanSolorzano Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
I have an interface like this:
@JonathanSolorzano 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
04:18
export interface ObjectMetadata {
    metadata?: {
        [key: string]: string;
    };
}
What I want is a uid key I send to this metadata property, but I don't know why const uid = object.metadata?['uid'] expects a colon after it...
dude just drop the question mark
that's not valid javascript syntax
80
Q: What is the question mark for in a Typescript parameter name

Whisherexport class Thread { id: string; lastMessage: Message; name: string; avatarSrc: string; constructor(id?: string, name?: string, avatarSrc?: string) { this.id = id || uuid(); this.name = name; this.avatarSrc = avatarSrc; } } In id? what's the...

@JonathanSolorzano how are you compiling from ts to js?
My opinion is that you probably aren't compiling to JS correctly just based on that syntax error.
This solved my problem:
let uid: string
if (object.metadata) uid = object.metadata['uid']
 
2 hours later…
06:30
Hey guys
I'm building a React app in Electron and I'm using a custom launch script
I launch the electron app, then start the React Server. I want to display a loading screen while waiting for the server to come online, how can I do this?
07:05
I've been able to narrow down the issue to something more specific
so my launch script launches electron and waits for the server to start. when it does I want to inform the electron main process. how do I do that? I tried using stdio but there seems to be something blocking it
Hey Suraj
08:02
@JacobSchneider out of curiosity, why would you need that?
have you tried a prod build and see how it looks like then?
08:41
<View style={{marginTop: 20, flex: 1, flexDirection: 'row'}}>
                        <Image source={require('../../assets/images/comment.png')} style={{
                            marginTop: 20, width: 32, height: 32, resizeMode: 'contain'}}/>
                        <Text style={{marginTop: 25, marginLeft: 15}}>Comment</Text>
                    </View>

                    <View>
                        <TextInput
                            style={{height: 65, marginTop: 15, borderColor: 'gray', borderWidth: 1}}
How to place button below text input ?
Currently the button is overlapping on textinput
I have a problem with hammer.js. I need to change the threshold of a swipeleft-action. I can't find examples in the docs.
My implementation:
1 message moved to Trash can
@Metaphysiker Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
      var element = document;
      var h = new Hammer(element);

      h.on("swiperight", function() {
        getPreviousSlide();
      })
What I tried to change the threshold:
h.get('swiperight').set({ threshold: 5 });
But this causes the following error:
TypeError: h.get(...) is null
Does someone know, how we change the threshold in hammer.js?
the error indicates that h is null
are you calling it in a different file / scope / location ?
or h.get('swiperight') is null
09:00
@KamilSolecki I have React wrapped in Electron. In order for me to be able to use my Electron instance, I have to launch the React server. But then I also have to launch Electron. The problem with this is that this requires two separate shell instances. I want to launch electron and React through a single NPM script ("start").

So my launch script firstly launches Electron with a loading screen. next it pings the React server. If no response, launch the server. Detecting when the server is ready is quite easy. when this happens, inform Electron to use React's output. But the issue is, I can
@KarelG Found the mistake: It should have been "swipe" instead of "swiperight". Thanks for your time
Don't you hate that??? when it's something so simple
my whole react app stopped working cause I used onclick instead of onClick
09:28
TIL Windows 10 night life feature
What's that?
@JacobSchneider what is a "react server"
react doesnt have a server
unless you mean your webpack one
@KarelG isn't that the sims addon
press window key and enter "night light"
it is a feature to not emit blue light during night time so that you can "sleep better".
@KamilSolecki I guess I mean webpack, but it's one that launches at "http://localhost:3000"
@KarelG Oh that, yeah
09:39
@JacobSchneider well, you could launch anything at almost any port so its not telling much :P
how about you do something like this
When you run react-scripts start
@KarelG so you mean something we've all been doing with f.lux for years now?
@KarelG I use hardware color temperature correction personally
On my site users can calculate budgets. Is there any way to when calculating a budget, I send that information to me?
09:55
@JoséMiranda what's "me"?
To my email
I think i can do that with php, but i dont know NOTHING of php
@JoséMiranda ohoo snooping people's data huh ~_~
I just want to know if the budget function is been used by users
@JacobSchneider again, thats tells nothing, because your command names are specified in package.json and you can set them to whatever you want
I suggest you take some time
and learn how to set up the whole project by yourself
incl. webpack and everything
@BartekBanachewicz "we"? I don't because I don't like my screen "behaving" differently than before
09:57
because its important that you understand whats going on, besides from just being able to write code off a boilerplate
@JoséMiranda google analyitcs if you just want to know if its has been used or not, if you need data thn u need to setup an Api call
@JoséMiranda just send data to your server and store it there or mail it from there
How i see that in google analyitcs?
@Karel
but be warned. In europe, we have a GDPR policy.
But how i send data to my server?
With javaScript
09:59
ajax call
The problem is: i only know html, javascript, css, java and c
send an ajax request with javascript to your server. That server can be in Node.js (sorta javascript) or Java EE
@KarelG it stays the same if you factor in the ambient light change
if you use incandescent bulbs at home they're much warmer than sunlight
so your white on the screen shifts relative to that
@JoséMiranda stackoverflow.com/questions/23740548/… just replace PHP server with yours one
but again, if your are serving EU people, you have to ensure that GDPR is enforced
10:04
you can send data if your website is used by tracking button clicks on your feature. But the data itself is protected. Don't send them unless you have the user's permission.
Thank you all, i'll use google analytics
10:22
you don't need to write any code to use google analytics
read some tutorials on how to hook up GA to certain functions / paths on your webpage
add it into Privacy Policy
Dan
Dan
Massively stuck with Encore Datatables if anyone has a clue how to fix this... stackoverflow.com/questions/54329671/…
10:41
I have the following router code
router.post( '/gettaskstodisplay' , ( req , res , next ) => {
  // console.log( req.body );
  // console.log('LALA !');
  let data = null;
  let QUERY = "SELECT task from mytasks";

  // console.log(QUERY);

  var connection = mysql.createConnection({
    host     : 'localhost',
    user     : 'root',
    password : '',
    database : 'mytasks'
  });

  connection.connect()

  // let vv = req.body;

  connection.query( QUERY  , function (err, rows, fields) {
    if (err) throw err
    data = rows;
in the frontend i have the following code to fetch the data
fetch('/gettaskstodisplay' , {
            method: "POST"
        })
        .then( ( resp ) => {
            console.log( resp );
        })
        .catch( ( err ) => {
            console.log( err );
        });
@AlexanderSolonik Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
somehow i don't get the vaules from the database that i retrive in my nodejs code
@cap
@CapricaSix corrected now
@AlexanderSolonik please be aware that javascript (and thus Node.js) is an event-driven platform. The database interaction happens asynchronously.
hi all I have a question about object
what is difference between menu[abcd[i]] and menu.abcd ?
you already have sent back the response while the connection.query(...) was still running
I can only recommend to understand this and read about Promises
10:52
@KamilSoleck i I ended up using a file system watcher. I was hoping to avoid that, but it seemed it wasn't possible in the end
sup
@AndyWarhol Those are two completely different things. The first one has abcd as an array and has the abcd array item at index i accessed on menu, the second one accesses an object with key abcd on menu.
@AndyWarhol menu[abcd[i]] returns with a value from object menu that has key name abcd[i], which is an array? (depends if array of objects or string) at index i
menu.abcd is then getting value from object menu at key 'abcd'
you can read menu.abcd as menu['abcd']
Hi I am working on this linkedin sharing button. But I am not able to figure out how to make it work. Anyone willing ot help? stackoverflow.com/questions/54290872/…
11:04
@NikxDa @KarelG so if I wanna access an array that have same value with an object I use menu[abcd[i]] ? and the other one is object of object ? am I correct ?
the abcd in menu.abcd is a string 'abcd'. So if you have an object menu { a: 1, abcd : 1111} then doing menu.abcd gives you 1111
I probably search all of google, but cannot find it lol
oh, I got it. so menu.abcd is a key of an object.
11:49
indeed
12:12
hi
We chose an object using the find method, We must store this object in another array(saveProduct), Each of Jason storeData objects we choose
1 message moved to Trash can
@Dani 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
ok
1 message moved to Trash can
@Dani 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
addItem = productId => {
  this.setState(prevState => {
    const { productData, storeData } = prevState;
    const product = productData.find(product => product.id === productId);

    if (!product) return null;

    return {
      storeData: {
        ...storeData,
        product
      }
    }
  })
}
Hey guys, really quick question what is the life span of localStorage en sessionStorage ?
12:22
@Dani and yours question is?
Use a formatter
@KarelG oh crap , thanks
its sinks in npw . TY
but even if i do
res.send('I AM SUCCESS');
I still don't get anything in my fetch that reads "I AM SUCCESS"
fetch('/gettaskstodisplay' , {
    method: "POST"
})
.then( ( resp ) => {
    console.log( resp );
})
that resp is a Response object
please put .text() beforehand to read out the string
--> fetch(...).then(r => r.text()).then(msg => console.log('msg: ' + msg)
for json responses, you have a .json() for that
see Response docs for more info
12:40
@KarelG thanks , i owe u a beer .
@AlexanderSolonik you better send him one, last time I promised someone a beer and didnt deliver, next day there were 5 men in black suits at my doorstep
scary stuff
@KamilSolecki Hey, if you owe a beer to a Belgian, ensure that you fulfill your promise boy...
@KarelG on another note, do you happen to know any local breweries shipping to europe
im looking for a specific thing
A Kriek lambic
user6718998
12:56
Hi guys. I need urgent help. I have this function to sort my array: pastebin.com/Mqedzd33 In theory I want to sort on object field that matches the params.field, so if field is an url param like: field=channel, I want to sort array based on channel, but I get undefined since it doesn't recognize it as an object of my object. What do ?
@KamilSolecki you are not the first foreigner asking it. I usually recommends beergium because I know some good webshops but they don't deliver to this or that country. I checked some and they don't deliver to Poland. So go with beergium
okie dokie thanks
@Thewise what does a.params.field give?
crap, they dont have a lambic type of kriek
I like the mort subite one but it is a heavy one (8° I think)
user6718998
13:09
a.params.field is nothing that is my problem, only a.channel exists and I want to use like a.params.field, but js reads it like that exact object name and not the value of params.field
user6718998
im now using a switch statement for every case of params.field.. but it looks so bad...
ah that
@KarelG oh thanks!
use a[params.field].localeCompare
(do that in your first pastebin)
user6718998
13:18
OMG
user6718998
i love you
user6718998
thanks
1 message moved to Trash can
@FredMcgiff Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
for this great question, most upvoted mentions using hash to solve this stackoverflow.com/questions/6985507/… one use
 if(!window.location.href = 'https://www.website.com';
so look like this
window.onload = function() {
    if(!window.location.href = 'https://www.website.com'; {
72
Q: One time page refresh after first page load

MartinI would like to implement a JavaScript code which states this: if the page is loaded completely, refresh the page immediately, but only once. I'm stuck at the "only once": window.onload = function () {window.location.reload()} this gives a loop without the "only once". jQuery is loaded if this...

for some reason, an important extension i using doesn't correctly run against the site the rules are assigned put it does if a refresh is done to the page milliseconds after page is loaded it runs
14:08
Hi guys, tell me please if I should use import Vue from 'vue'; in multiple files? For example I have parent and two child components. I have to import vue in parent, but I use .Vue.directive(...) in child too and if I don't import vue in child I got error that Vue.directive is undefined.
It's anti-patterns or something wrong if I import Vuew in multiple files?
14:23
posted on January 25, 2019 by CommitStrip

14:38
@KarelG @KamilSolecki LOOL :P
15:15
@All Extending this question: https://stackoverflow.com/questions/53922010/why-does-0-evaluate-to/53922033

What is the most messed up syntax you can come up with that still evaluates?
Hey someone know if mouse events are sync with frame ? Like RAF. Or is it something possible that 2 events fire within the same frame ? =)
input events come between frames, and there's no limit for how many you'll get
Ok so if these events are directly related to an animation I guess it would be better to debounce it with a RAF
You shouldn't normally be debouncing multiple events in a single frame
Don't assume your users are hunt-and-peck
@Neil don't believe everything that breaker dude is saying.
15:30
@KarelG Meh, I'm humoring him mostly :)
16:12
@MadaraUchiha found an imposter stackoverflow.com/questions/54367988/…
user1596138
16:37
@Feeds Beach front Omaha..... I dig
@TylerH Eh, Madara Uchiha is a fairly well-known name
He's not the only one you'd find, if you searched, I reckon.
s/well-known/weeb/
user1596138
lol
user1596138
17:04
I went outside
user1596138
That was a bad call
user1596138
-10 wind chill
don't ever do it again
user1596138
I wont
user1596138
Not until April or so
17:05
:meh:
here in Phoenix everyone is wearing jackets but it won't go below 50
Tuesday/Wednesday next week is supposed to be a low of -23 F
anything lower than 45 is equally cold
Oh no, you notice when it's below 0. It's a different kind of cold
45 deg fahrenheit is absolute zero
@ndugger see, in that weather, I would definitely consider a jacket
17:07
My CV transmission in my car was struggling to change gears leaving work yesterday. Made all kinds of weird squeeks and moans until it warmed up
user1596138
It was -15F the other day here.. Before wind chill
user1596138
15min frost bite advisory. Nonessential travel is a $300 fine
whoa I didn't know that was a thing
user1596138
Indiana does it a lot. We have 3 levels of travel status
I guess you just.. don't have homeless people then
user1596138
17:09
First responders can hardly even help you with -20 and below after wind chill.
user1596138
Yeah they die each winter if they don't get indoors. Thats for sure
in Phx most of the homeless people survive the summer
they just lose their minds
user1596138
In this time of year I always have a gas zippo warmer in my chest pocket when I leave lol
ugh I do not plan on living in a place like that
user1596138
Some nights I bring my car batteries into the kitchen and re-hook them in the morning
17:11
I prefer sun-induced psychosis
user1596138
Since they will be frozen and won't start my V8s lol
user1596138
I run Optima yellow tops too. Not some cheap shit
I feel like everyone should have a garage there
user1596138
I mean I do but it's not heated unless I run my propane jet
user1596138
17:12
And I have my nice car and my project truck in there. Not my daily truck
I keep my lifted prius in my neighbors garage
user1596138
Your lifted Prius with a CV lol
now that's the power of german engineering
user1596138
You also have to remember to open the windows before you park the car for the night
user1596138
17:14
Because if you leave it full of hot air the inside is covered in ice the next morning
user1596138
I thought condensation worked like the other way around? But it happens to me at least
I just sit in the car in the garage with the engine running for 30 minutes before I leave
user1596138
That works if you never want to leave.
user1596138
Who turns it off after 30mins?
17:31
you forget that ndugger is immortal
I really can't believe React took over web development
It's like, we were almost there, we shake off all the bad habits, from 1990 putting like anything into the same file... and now, almost 2020, we start over. Putting Logic, markup and design into one clusterfuck and we are proud about it
In my opinion, it's the most intuitive. Component-based architecture for UI makes it exceptionally easy to reason about a "chunk" of functionality
I'm ramping up in C++ right now, because of WASM. I want to create a WebGPU-rendered UI library that is very much so based off of React paradigms
18:27
We had a pro SCII player in this room at one point, didn't we?
user1596138
@jAndy Sounds like you're doing it wrong
user1596138
Component logic is fine to have in the file IMO. Shouldn't be a whole lot
user1596138
Shouldn't be hardly any
user1596138
Of course this is just my opinion
it just works
user1596138
18:33
I think at this point the issue is that if you do it "right" you have thousands of tiny files lol
user1596138
Like. Sometimes stupid tiny. In a runtime language where everything is compiled through Babel etc because browsers are able to stay decades behind the language lol
18:55
$(".add_cart").click(function() {
                var prodcut = $.get($(this).attr('ten'));

                alert(prodcut);
)};
is that a typo, or a correct spelling in another language
prodcut
00:00 - 19:0019:00 - 23:00

« first day (3023 days earlier)      last day (2150 days later) »