« first day (2317 days earlier)      last day (2630 days later) » 
00:00 - 20:0020:00 - 00:00

12:02 AM
making frontend apps is hard
 
nah, fun
drop the angular and get with a hero
 
yeah .. well, now I am trying to work out, how to implement token-based authentication/authorization, with multiple identities coming from localStorage
all of my "server-side code" is only accessible via an API
I am sending server multiple single-use tokens and the server is responding with the identity it picked and the new token
 
authentication with tokens is not simple but extremely common and you can find examples or integrations for virtually any frontend/backend combo
 
12:56 AM
Howdy
Just just had Chinese for dinner
Well technically Thai
 
you probably should refrain from eating people in the future
 
1:27 AM
@tereško ...Why
 
which part confused you?
 
All of it
 
then I can't help you
 
Ok i'll start with one question I guess
Why are you using single use tokens?
 
because I need to identify the user on the API side
 
1:30 AM
Ok
How does the user get their token?
 
by sending API server a proof of identity (by default: username and password)
 
And they have to do that with every request?
Or do you send back a new token after each request
Or something else
 
you probably should look up "single-use" in dictionary
 
What am I misunderstanding?
Single use means you use it once and throw it away
 
Hello
 
1:43 AM
guys please help
I am looking everywhere on google but I cannot find wjat I need
 
Then describe your problem.
 
get all keys with a certain value in nested object
 
Sounds fun lol
 
Just do a recursive iteration
 
can you suggest some link or some snippet please?
 
1:48 AM
Yeah just do what you described
 
Can you give an example object
 
If the value matches your search term, add it to the list
If the value is an object, perform the search on it
Otherwise do nothing
 
example object:
var obj = {
		"sdyfugyds": {
			"suygdfudys": "suydgfsugyf",
			"suydgfuys": "sudygfsuy"
		},
		"sudygfysuf": {
			"sudyfggs": "ysugufdsygf",
			"suydgfyd": "sydgfudsygf"
		}
}
 
@neoDev get all keys how
as an array of strings?
 
yes it could be great
I am stuck at the recursive logic atm
 
1:51 AM
I gave it to you
 
I was creating this (but not finished yet)
function blabla(obj, val){
		let result = [];
		for(let i in obj){
			if(i instanceof Object){
				blabla(obj[i], val);
			}
		}
	}
a nice output would contain key + value ideally
 
How to add code?
In here?
var obj = {
	a: "b",
	c: {
		d: "b",
		e: "f",
    }
}

function getObjKeysByValue (obj, value) {
	var keys = [];
	for (var prop in obj) {
		if (obj.hasOwnProperty (prop)) {
			if (typeof (obj[prop]) === "object") keys.push.apply (keys, getObjKeysByValue (obj[prop], value));
			if (typeof (obj[prop]) === "string") if (obj[prop] === value) keys.push (prop);
        }
    }
	return keys;
}

getObjKeysByValue (obj, "b");
Here you go
 
Hello, I know this is a JS chat, but not getting any help from the JAVA rooms. Can anyone answer this please.
 
@TeamAmplified Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
You probably won't get any help here.
 
2:01 AM
1 message moved to Trash can
@TeamAmplified 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
 
Oh okay, but just incase.
 
@NikxDa thank you! :) it helps me to understand and I think I can easily adapt to my current needs
 
@TeamAmplified As you noticed, this is a JavaScript chatroom. Since JavaScript is not Java, please don't ask it in here
2
 
Hello, is there anyway that I can stick this in a for loop??? This is part of the logic for a ticTacToe game, I am checking the button clicked via ActionListener, then I am checking for a boolean value, and thats how I determine wether to place an X or O.
if(src == b1){
   if(firstPlayer){
      b1.setIcon(playerO);
      firstPlayer = false;
} else {
   b1.setIcon(playerX);
   firstPlayer = true;
}
}
Sorry
@NikxDa sorry.
 
Does anyone in here have experience with Javascript custom REST Apis?
 
2:07 AM
Yeah
 
I have a large-scale project written in Node which uses a fairly big REST Api, and I want to write a JavaScript Wrapper for it.
Any layout tips?
 
Layout as in?
 
Architecture
 
Of the wrapper?
I usually go for a one to one correspondence with the api
So /user/meredith/profile might be user('meredith').profile()
Or user.profile('meredith')
Depending on how you want to do it
 
Sure, I was thinking about tips on how to wrap requests and stuff like this. Should I write an interceptor for header fields, should I use a modular approach, chainable, Promise/Callback based, and so on
I could also use ES6 yield
 
2:14 AM
Up to you I guess
I prefer to chain requests together and promises help with that
A common pattern is something like
Thread(id)
  .posts()
  .then(posts => posts.map(process somehow))
  .then(displayPosts)
 
2:37 AM
hooray
 
 
1 hour later…
3:46 AM
;p
 
 
3 hours later…
7:03 AM
Expedition ES6
 
es6 is the new javascript version for gaming in html5 I think. I did learn it in tutorial
 
Can i use it for production?
like browser compatibility ?
 
only chrome supported it. or so I thought
 
@Cerbrus I have to need time to understand this graph Thanks in advance
In general ES6 ready for production !
 
 
2 hours later…
8:51 AM
Hi everyone
What is the most efficient way to turning a multidimensional array into an array with objects
 
9:09 AM
give an example before/after?
 
9:33 AM
@Leyth .map :P
 
 
1 hour later…
10:54 AM
Hi
 
@AdityaRai Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
I have a question, how to display pdf stream in a modal window using ajax
 
pdf stream?
 
the url i am calling in ajax has response type "application/pdf"
 
11:17 AM
the http responseText that i am receiving is something like %PDF-1.4
%����
1 0 obj
<</Type/Page/Parent 19 0 R/Contents 16 0 R/MediaBox[0 0 612 792]/Group 2 0 R/Resources<</ProcSet[/PDF/Text/ImageB/ImageC/ImageI]/Font<</F1 3 0 R/F2 7 0 R/F3 11 0 R>>/XObject<</Im4 15 0 R>>>>>>
endobj
2 0 obj
<</S/Transparency/CS/DeviceRGB/I true>>
endobj
3 0 obj
<</Type/Font/Subtype/TrueType/BaseFont/BAAAAA+Tahoma-Bold/FirstChar 0/LastChar 32/FontDescriptor 4 0 R/ToUnicode 6 0 R/Widths[1000 893 684 770 757 612 770 292 657 745 738 684 483 667 615 633 415 433 598 578 593 514 629 593 362 301 617 454 454 431 72
how to use this js to show this as pdf inside a div
 
11:28 AM
quick redux question, where should I create the id for a new item? In the action?
In this example it happens in the reducer, however I need the id in more than 1 reducer so I'm not quite sure how to go about that
 
29 mins ago, by Zirak
@AdityaRai https://mozilla.github.io/pdf.js/ ?
 
12:36 PM
what is the best way to clean out a shared object?
is there something like Object.empty(shared)
nevermind
I will just wrap it in another object and pass that one around instead :D
 
Morning guys.
Can anybody please tell what should I go with?
Gulp or grunt or webpack?
When to use what?
I've searched a lot but cannot find an appropriate answer :/
 
I use webpack for assembling JS code and gulp for sass ... and (sometimes) for running webpack :D
 
What?
But gulp can do that tooasdasd
Then why webpack?
 
12:51 PM
because it's easier to produce all-in-one bundle files
 
What about the images, css?
 
gulp
 
You mean, only use Webpack for JS file
 
and with "images" I assume you meant "sprites"
@ZahidSaeed it also lets me write in ES2015
 
Gulp has some features too like concat all JS files and then minify it
as a bundle
Gulp has babelify too
 
12:54 PM
you have already decided, so stop wasting my time
 
No no
I just want a solid difference
 
the names are different
done
 
oh come on
I've read that use gulp for front end tasks
 
 
1 hour later…
2:11 PM
@
c
a
@copy ** ahhoy
 
u k m8?
 
my enter key occasionally sticks
after logging in
 
bring your machine to a doctor
what browser are you using?
 
I usually just take it out to pasture
chrome
 
bob
2:35 PM
I'm setting up desktop notifications anyone got a suggestion of a good git? that works on all browsers.
 
2:49 PM
clone is my favorite
 
what is up everyone!
This is your friend pwediepie
 
lies
 
yes I am
lies
 
TIL javascript has labels, kinda
Little known JavaScript feature! You can use labels with break & continue statements Useful to break out of loop of… https://twitter.com/i/web/status/832607489187315712
 
3:10 PM
I'm thinking of building a table component in react.
But I'll require something that's super easy to adapt to particular needs.
 
Do go on.
 
What should be the way to go about this... I'm having some questions about the implementation here.
Before I continue, let me show a little example of what I'm trying to accomplish, only in this case it's a button (and not a table)
 
What is the components purpose? loop over some array of data and make a table?
ok
 
In that example the button is called "Component". But anyone that uses it can customize to suit their needs.
 
That's a confusing name.
But ok.. I follow. I don't see the value of this component yet, is just wrapps <button /> but go on.
 
3:15 PM
what should the new table component do... how will I structure it?
 
What do YOU want it to do?
Make up a sample use.
 
hm... I should've asked those questions about the button implmentation early on... because I don't really understand the value either... but that's what my team wanted.
ok. So the table should eat up some data and spit out table HTML. That part is easy.
 
Well, if if it's for all buttons in your app then the value can be that it gives a simple point of adding features to all buttons
like maybe you want to protect against double clicks, but change appearance based off of a promise returned from onClick
 
I think they'll be aiming for it to be customizable, so maybe add some themes or at least keep it open to custom CSS classes the user may want to add.
 
aye
 
3:20 PM
@Luggage that must be it... a single implementation for all buttons everywhere. Adapted to each site's needs
 
// I have a data table component I use like this:
<DataTable rows={users}>
    <DataColumn header="Name" valueFn={row => row.lastName + ', ' + row.firstName} />
    <DataColumn header="Actions" valueFn={row => <a href={`/users/${row.id}/edit`} >Edit</a>} />
</DataTable>
 
How would you structure it to be responsive? The way I see it the <table> isn't really easy to make responsive, so people sometimes preffer lists...
 
well, tables are for tabular data, so they aren'y typically TOO responsive.
a horizontal scroll is often used for small screens
(e.g. bootstrap's .table-responsive)
 
that's also a tricky problem... because I think some of our sites are focused on being responsive... others not so much.
 
yup. i use that.
 
3:25 PM
there's a decent implmentation right there. My team didn't like them though.
 
Their <Table> component is just a thin wrapper around <table>. It just adds a few classes.
it doesn't really do anything more
in other words, it applies a style, not functionality
 
you still need to pass in the data formatted as table elements no?
 
yes
 
Do you know any cool examples I can look into?
for inspiration. The way I see it I still need to get back with a load of questions... maybe I'll even need to settle some of those myself.
 
not without knowing what you even want out of a table component
you haven't even given a problem you are trying to solve
 
3:33 PM
It's like the button. The goal is to have a single table implementation that rules all. Costumizable enough that suits everyone's needs.
 
 
1 hour later…
4:52 PM
I made it :D
 
@Abhishrek I made this with salmon :D
 
Yummy!
 
I think I heated a meal up at some point in my life
 
That was the first time I made pizza
 
next time, make it with yummy ingredients :P
 
5:07 PM
Well we baked 3
 
What is that even, prunes or something?
 
The yummy ingredient one, we just ate it off before we could shoot a picture
@KendallFrey sun-dried tomatoes in olive oil
 
oh that sounds better than it looks
 
yeah
 
pizza isn't pizza without tomato sauce though :)
 
5:08 PM
 
or meat
 
@KendallFrey The one who taught me doesn't really like tomato sauce, tonight I'll try with tomato sauce
 
<script type="text/javascript">window.location="http://google.com";</script>
Ho no , don't misunderstand
 
nice try
 
@KendallFrey None pizza left beef
 
5:12 PM
XD
 
Hey , guys I've very less reputation so I dont wanna start a bounty but can someone help me out on this question: - stackoverflow.com/questions/41649648/…
 
-1
Q: How to find symmetric square root of any number in C#

Ghulam Mujtaba KhanYesterday my teacher gave us a assignment to find symmetric square root of any given integer number Please can anybody tell me how to do.Thanks And second question is that write a program that input a binary number and tell us no. of total zeroes between two ones. Please give me any solution. I h...

cv?
 
afaict, "symmetric square root of a number" is not a concept that exists
 
github.com/SirCmpwn/evilpass this is hilarious
4
 
5:28 PM
> Usage

Please don't actually use this.
 
That's actually... probably a good idea
 
btw, as a back+front end project I was thinking of doing something actually useful that I guess would have helped me a lot when I was trying to simply do front-end stuff without caring about back-end too much, but there's probably a lot I'm not thinking about, so I'm running it through people listening here first...
the idea is to make a very simple website to store information, with an api to set and get things
so you can easily xhr my website to get/set things... makes sense so far
I would want to ensure the users that their stuff won't just be overwritten
so, for who wants that, there could be a free account system in which they have a maximum of, say, 10MB of cumulative data (with the intent of making it as easy as possible, so I wouldn't throw numbers at them), from which they'd have a different get-set account thing, and they could choose from which domains to accept sets and from which domains to accept gets
it doesn't matter if I actually get this to be a thing that people use, what matters is if I can produce the code with both front and back end to make this work nicely, then if it works too nicely (I doubt it, as it's just an experiment) I'd sell it (rather than worrying about buying my own servers and stuff), otherwise just put it on github to have everyone benefit from it
the main issue I can think of with this is how to limit spam of sets/gets from non-accounts
it would be ideal to have it so one can simply call to POST website.com/set/athing "some stuff", without setting up an account or anything, so they could try it and make simple temporary demos with them
I could just make the speed for the non-account to be very slow and have a very limited queue for every domain/ip this comes from, so if there are more than, say, 5 requests coming from a certain ip, if a new one is sent, it is simply dropped
this would still mean that there could be thousands of requests coming every second without too much effort on the user, although it's already slightly limiting
 
wow that is a lot of characters
 
although, again, I would have loved to have something like this to play around when I only did front-end, and I bet my lambdas that many others would as well
 
5:44 PM
In a cover letter I wrote:
...I moved forward with my studies from my last work experience...
is that form correct?
I feel like I did a mistake..
 
6:28 PM
@neoDev What are you trying to say?
 
hi madara
that from last work experience I did further studies
and I improved myself
 
6:57 PM
good job on improving yourself
 
Hello guys, I don't mean to bother anybody but I am having a problem with retriving data, maybe somebody has the solution ?
http://stackoverflow.com/questions/42310314/how-to-retrieve-previous-data-with-firebase
 
@FrenchyNYC Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Hey guys, could someone help me with a little script? for some reason I am question banned even tho all my questions have neutral or positive feedback..
So I kind of have to ask here :|
 
@Omnitored so?
 
I used the script from the answer in this question: stackoverflow.com/questions/22710180/…
However, the js does not accept line shifts (enter) in between the ""
And I would like the text to be written with spaces between lines in a textbox..
 
7:04 PM
what are you trying to do
 
You know those fancy "anti ddos checking your connection" loading pages?
 
and?
 
I want to make something like that and during the loading a big textfield covering the entire page will write out the index html source code
but it would obviously look way better with spacing than all-in-one line
 
why you need to put inside an ijnput?
can it be a div?
or semthing else?
 
It can be anything really
 
7:06 PM
ok
 
What I am trying to achieve is:
 
I suggest a div, or even a <pre>/<code>
note that pre element preserves indentation
as CSS white-space: pre
 
any idea how to achieve the effect I want?
 
basicly you need to absolutely position the element in the page
width: 100%
height: 100%
then fill its innerHTML with the source code
right?
 
Yes but how to get the text to be automatically written out
 
7:09 PM
do you want it to be written slowly
or not?
 
I don't want it to appear all instantly
yeh, that's the plan, that's why I have the javascript code
and the html:
 
1 message moved to Trash can
@Omnitored 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
 
pleas ecreate a fiddle
 
ah ok
 
so you are done
what else do you need?
 
...
Same as I said at the beginning
 
fullscreen?
 
Try putting for example
<!DOCTYPE HTML>
<html>
in between the "" in var type_this
as soon as you use an "enter" it all breaks
 
how do you retrieve the source code?
 
7:14 PM
Doesn't really matter I haven't thought of a way yet so open to any suggestion
basicly
rightclick this chat page and open source code
page source*
 
you could use some beautifier
 
I want to print out exactly the same way
with the colors n' spacings n stuff
 
use a text editor control like codemirror or ace editor
 
how will that help me with outputting this on the website?..
 
they are web libraries..
 
7:15 PM
@Omnitored would you like to colaborate on this project on Github with me?
it is interesting for me
 
I am a plain beginner in js
so I wouldn't be to much help
 
do not worry
let's go
 
okay :)
 
:D
 
Also, how to contact a mod? I am kind of question banned and I have no idea why :|
 
7:32 PM
Try to invite one to a chat
 
Hey, quick question (I hope). I have a link which has an event handler onclick, which changes what is visible. I have another event which gets the keyup event, and will close the box that has what is visible when [Enter] is pressed. My problem is that when the link is focused, and the user hits enter, it should only change the view, but it's both changing the view and closing the viewbox. How can I prevent that?
 
emm ... guys
does this work as intended?
let [id, expires] = [
    parseInt(identities[key].user),
    parseInt(identities[key].expires)
];
 
@tereško, seems to: jsfiddle.net/oq44kv1v
 
yeah, I should have just checked
 
7:48 PM
@tereško indeed
 
Morning
@tereško Yes, although in that particular case I'd go with
const {user, expires} = identities[key];
Or something of that sort.
You don't gain much clarity from the destructuring in that case
 
@MadaraUchiha I loose the type-casting then
 
@tereško That's true
In that case, why not simply
 
it's not so important for the user, but it would be beneficial for the timestamp
 
const id = parseInt(...),
      expires = parseInt(...);
 
7:58 PM
also, does the cat that entity cotnains other field not affect it?
 
I mean, the destructuring doesn't make it clearer here
@tereško No.
 
k
 
Unmentioned keys are ignored in a destructuring assignment
 
then I will go with a mix
 
Also, prefer const to let
 
7:59 PM
will it play well with a function called withing a forEach() ?
 
00:00 - 20:0020:00 - 00:00

« first day (2317 days earlier)      last day (2630 days later) »