« first day (1875 days earlier)      last day (3076 days later) » 

12:00 AM
gotcha
 
going to sleep, see you!!
 
so say I have 500000 entries, each with a list of regions in it. for example, I want to retrieve a list of all birds in the North America region
how would I do that?
you'd likely have a single collection with a bunch of documents - one for each bird... and each bird entry would have a "locations" sub-document that would contain a list of locations, right?
how would you do that query?
right, but what would the query look like?
assuming your doc is like this...
{
    "name": "Robin",
    "locations":
    {[
        "North America",
        "Pacific Islands"
    ]}
}
{
    "name": "Seagull",
    "locations":
    {[
        "North America",
        "Pacific Islands"
    ]}
}
{
    "name": "Some tropical bird",
    "locations":
    {[
        "Pacific Islands"
    ]}
}
@ton.yeung keep in mind, I'm literally watching MongoDB 101 videos right now :P
 
codeman! i have a query
 
@user3237317 Welcome to the JavaScript chat! Please review the room pseudo-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.
 
this is my first time here
 
12:05 AM
I'm probably not the person you want to be talking to then
@ton.yeung he didn't ping me :)
but yeah... just ask your question. Ideally just post your question on SO and ask for help improving it is the best thing you can do
@ton.yeung I'm thinking about interesting ways to build this bird watching thing
 
can i share stackoverflow question url here
 
I learned a bit of Node and Express... so I'm trying to learn Mongo now
yes, go ahead
 
thanks
 
@ton.yeung don't do what?
 
here is my question
0
Q: navigation appears when i scroll down page--it should appear on page load

user3237317Navigation appears when i scroll down page, i wants it should appear on page load. here is jQuery code i am using, <script type="text/javascript"> $(document).scroll(function() { if ($(this).scrollTop() == 20) { $("#floating-nav-content").slideUp(400); } else { ...

 
12:07 AM
@ton.yeung it's just to learn. It's not for a client project or anything
I just want to learn the stuff :P
 
can any one help me with my question!
 
well... I need to know how the tech works before I can determine if it's the right technical choice or not :P
@user3237317 you posted your question, best to allow people to respond on their own time. This is an all volunteer service
@ton.yeung nope. I want a boring old MEAN stack app that fulfills its purpose
the fact that it's MEAN is interesting enough for me atm ;)
ciao
 
adios
 
cheers
 
was a great show
 
12:09 AM
Any genius want to take a stab at my question on SO? You'll get free points on the answerrrr
 
I got here at 9:30. It's 4pm. I'm gonna go home now
tomorrow is my last day. lol
I had to email my manager to get instructions on what to do with my laptop and stuff... I don't think they're used to people quitting here
 
@DemCodeLines where is the code to show it onload?
the question isn't very detailed.
 
sounds like a good (soon to be former) employer then.
 
you don't really explain the full expected behavior and what is exactly the problem
and the code you show has nothing to do with what happens onload
 
@rlemon onload?
 
12:13 AM
> Navigation appears when i scroll down page, i wants it should appear on page load.
then you only show the code for it to appear on scroll.
 
I think you're looking at the wrong question.
 
OHHHHH
yea
 
30 mins ago, by DemCodeLines
0
Q: AngularJS routes not displaying the right view

DemCodeLinesI have a AngularJS/ExpressJS app and seem to be having a routing issue. login.ejs and signup.ejs are partial views, while welcome.ejs is the main template (that should load these views in a ui-view container). Ideally, /welcome would bring up the welcome.ejs page (the page already has login.ejs p...

 
I am
 
That's mine
 
12:14 AM
@user3237317 read everything I just said to @DemCodeLines
oops :D
@DemCodeLines my bad, sorry I don't know angular
I just scrolled up to the nearest Q and assumed it was what you were talking about
 
didn't even look at the user
 
actually, my navigation appears when i scrol down page a little like 30px
it should appear on once page loaded.
code for this i am using is
 
@user3237317 probably at 20px? (in the question, 10px here on chat)
 
1 message moved to Trash can
@user3237317 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 or pastie.org
 
12:18 AM
yes
 
@Luggage where are me madara mosho and Zirak?
 
crl
Zirak is in Israel or no? I need to see him :) I feel like yes
 
you are right but my concern is it should appear once page loaded, it should not wait for me to scroll down
if you can edit that code in my question then plz it will be appericated
 
12:22 AM
@GitaarLAB plz go through my last msg
 
@user3237317 The page you linked to in your question is currently dead.
What is the code in your question supposed to do (according to you)?
 
Someone know about a way to create an input mask, for example (###) ###-####
?
 
@user3237317 I think rahul's answer you linked to is correct. But that doesn't answer what your reasoning is behind the code you wrote? Why do you hook the document scroll?
 
i am not well with Jquery, i wants some one to modify that code
 
12:30 AM
@user3237317 this isn't the place for that
 
Pay me $1 billion and I will do it.
 
we are here to help you learn, not to write code for you
please do not ask for that
 
lol, if you want rahul to modify the code directly, then pay him his fee (I hear it's one billion (US billion?)) and give him access to your server: stackoverflow.com/questions/34078403/…
 
hmm
 
@user3237317 your question has a really good answer explaining what you must do. Please take some time to try to implement it.
 
12:31 AM
@SomeKittens very nice
 
thanks @rlemon
 
@BenjaminGruenbaum I was there for the talk itself (and food afterwards). Netflix engineers are another level of smart
 
Yeah they managed to hire well.
 
@feniixx input mask for what? input type=text?
 
12:37 AM
this is absolutely hilarious
repost from <room name censored>
 
@BartekBanachewicz I really wanna know what got axed
do you know?
 
do I know what
 
i was not amused
inb4 "sjw"
 
@JGallardo yeah people posting that on twitter can be accurately described as SJWs
 
or having a more refined sense of humor
oops...
 
12:39 AM
@JGallardo wait
you don't think the people who reposted it from 4chan were joking, right?
 
@BartekBanachewicz irc
 
don't mind me i'm drunk
 
[triggering intensifies in the room]
ok speaking of javascript....
 
@GitaarLAB yeah for an input type text
 
12:44 AM
@JGallardo now that is a trigger word
 
setInterval(encouragingComment, 6e5)
 
crl
*realize my sense of humor is not like others'
 
@rlemon interval: you go rlemon!
 
Someone has ever made a vertical heading table with add row vertically?
 
someone has.
how can I go about having a circle border around an image in an image carousel that lights up according to how much time is left before the next image?
 
crl
12:50 AM
1st link
 
i am using supersliders. but a designer requested this type of feature i have not seen. I am sure I can google it and figure it out in a couple hours but wondering if there are existing libraries
 
@feniixx have you tried layering an input on top over a span element, then hooking the input element onchange/onkeyup/onmouseup events which then works in harmony with the span in the background?
 
Hmmm not really
isn't there a simple way?
 
12:55 AM
wip obviously
 
@GitaarLAB any angular way?
 
it's the guy who wants to hire me for my animations
 
@feniixx The code in that answer gives a clear example of the tasks being executed. I'd imagine you can re-write this to any library (or just pure javascript). One extra note: deciding what valid formats are is most often a bad idea. (in the context of people's names, address info etc.)
 
@GitaarLAB Thnks, it's not for that kind of info, that was an example, I need it for a identifier card, like driving licenses, etc..
 
You are welcome. If there is a guaranteed fixed format (unlike the examples I mentioned) then go for it. In these cases often 'they' use multiple input-fields
 
1:03 AM
@feniixx nope
and before you make a hack using first td as if it was th then just don't instead
 
@JGallardo You don't need a library, you can just apply some circular css to image on a timer.
 
user5365803
hello
 
@rism oh interesting. i guess you can do it in css3. found this example

http://cssdeck.com/labs/css3-animated-circles
 
@towc looks good... could be better.. I can't really say how
maybe play with shadows to enhance perspective?
like, 8/10
 
@rlemon do you know the alonelysquare project?
 
1:12 AM
but if you want 10/10
then work on it
@towc nope
 
yeah, I'll definitely put some finishing touches once I know what I'm actually going for :P I might even get an 8.1/10 from you :D
 
@JGallardo Yep there's heaps of examples. So stuff your images into an array and simply step them through some state change on some timer interval.
 
the idea is that you have a black square in the center of a white square
and the side of the square is 1/3 the side of the bigger one
 
Or img.currentState = off|low|med|high; etc.
 
1:14 AM
who made that project told people to do any animation they want that starts and ends with it
and now they have all kinds of cool animations that can be chained toghether
the guy's company's symbol is the //, I was thinking about doing the same
 
Or use a function and have the image manage it's own CSS according to state.
 
he wants it to be aggressive-ish. If you have any idea that could fit and that you think I should know about please tell me ;)
I have a few, but I'm trying to pick up the best ones
 
1:25 AM
Can anybody please help me understand this script? I can't understand why in the else part at the bottom it is addValues; and not addValues();. jsbin.com/biwifa/edit?js,console
 
@RahulDesai It's returning the function each time so you can apply it to other numbers in the chain.
 
someone should revoke their licence to pc
 
13k ?
lol
 
"50% more powerful than xbone", that can be accomplished with a $450 build
 
@KingMob Gotcha. Thanks man.
 
1:34 AM
shitheads like this are why some people keep insisting that PC gaming is "too expensive"
 
1:46 AM
Well, I tried installing a new Graphics Card yesterday, and now I'm fighting to get my OS to boot. Console gaming isn't looking so bad.
 
@tereško wow, 12 cores are 50% more powerful than 6 cores?
Why don't they add cores to xbox??
 
Can you store HTML or templates in localStorage, if you felt so inclined?
 
Add more cores -> better performance
@corvid Why couldn't you?
 
Well I'm thinking. If you can store the most-used templates in a localStorage unit, and only query for the diff on each page load after that, would that significantly reduce that amount of data sent over the wire? And if I have thought this, so has probably everyone who does web dev, so is there a framework for this?
 
doubling != 50%
 
1:51 AM
You want to cache resources? Appcache and descendants?
@rism I'm so tired right now that 50% more of anything is 6
 
Appcache on MDN says
> This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.
 
> and descendants
Service workers, namely
 
fair enough
 
"Appcache and descendants" sounds like a really bad Christian rock band
So, you're talking about service workers, that looks like exactly it, thank you sir
 
Heh, someone from Asia is trying to access my Humble Bundle account
 
2:01 AM
Well, I've got my desktop booting now... into Windows XP. Wow. Didn't realize that was still on that machine.
Double clicking one of my drives in My Computer runs ipconfig. What the heck did I do to this OS?
 
2:40 AM
hi guys
any one here know angular ?
 
psh, never heard of it. Is it like jquery?
 
one of the framework
OMG
:(
 
2:55 AM
If anybody wants to review my code and give me some feedback:
1
Q: To "this" or not to "this"?

Rahul DesaiI was given a homework and I have 2 solutions: one that uses this and other one that doesn't. I tested it on jsPerf but sometimes it says the version with this is faster or sometimes the other one. So I think I cannot really rely on jsPerf. But then, should performance be always the top priority...

Why is jsPerf being so unreliable? It is giving me different results everytime. Sometime's the first code is faster, sometimes the second.
http://jsperf.com/this-or-no-this
 
function addg(x) {
    var sum = x;

    return function add(y) {
        if (arguments.length < 1) {
            return sum;
        }
        sum += y;
        return add;
    }
}
@RahulDesai Maybe it makes no difference and you're micro benchnarking
Maybe you wrote the tests wrong
 
@zirak owned
 
Maybe writing perf tests isn't just chugging code in
 
@Zirak micro benchmarking?
 
function addg(num) {
  if (!this.sum) { this.sum = 0; }
  if (isNaN(num)) { return this.sum; }
  return addg.bind({sum: this.sum + num});
}
 
3:00 AM
hey guys
 
@SomeKittens the bind at runtime will haunt performance
 
@RahulDesai worrying about tiny things that don't actually matter.
@RahulDesai @Abhishrek is perf part of your grade?
 
Not my homework v_v'
 
//TODO: optimize
 
@SomeKittens Oh,ok. And, no.
 
3:01 AM
!!s/,/ and /
 
@Abhishrek @SomeKittens Oh and ok. And, no. (source)
 
@Zirak Crockford hates arguments. He recommends not to use it.
@SomeKittens Your version looks nice and compact.
 
with Rest Parameters, we don't need arguments anymore, mostly.
function foo(...args) {
}
 
@SomeKittens addg() needs to return undefined. Other tests look good.
 
function addg(num) {
  if (isNaN(num)) { return this.sum; }
  if (!this.sum) { this.sum = 0; }
  return addg.bind({sum: this.sum + num});
}
just swap the first two lines
 
3:12 AM
@SomeKittens Wow. Thats awesome!
 
actually, don't think that'll work in strict mode
 
3:23 AM
Why mess around with .bind when you don't need to? I've never seen code with .bind and though "Wow, this is really intuitive and clear!" :P
 
Bind is slower than closure, too.
 
How about call or apply?
 
@RahulDesai They are quite a bit more efficient than bind. What are you trying to do?
 
3:35 AM
function addg ( num ) {
   const recur = ( val ) => val === undefined ? num : ( num += val, recur );
   return num === undefined ? num : recur;
}
 
ES6
8)
 
This code is easily converted to ES5. You can even do it online.
Or manually.
 
Yours is the most elegant version that I have seen so far. :)
Can you please explain what is going on in the first line inside the function?
 
I don't want to open an account on code review - I will either faint or die from exhaustion - so you can post it as answer and put link to my SO account.
 
why
 
3:40 AM
@RahulDesai The "current count" is stored in num. If first parameter is undefined, return num. Otherwise, increase num and return the same function - with keeps the same num alive.
This approach has the side effect that you cannot "cache" a partial result. You cannot say var nine = addg(5)(4) and reuse it for two different calculations.
The solution, if you need that capability, is also simple: create a new closure for num every time.
 
I need to spend some time familiarizing the ES6 syntaxes.
 
@nick Yeah. Good question. I don't think I have a logical answer. To you or to me.
 
@Sheepy I am familiar with => but what is ( num += val, recur ) at the end?
 
@Sheepy that was deep
 
is that equivalent to function(num += val, recur){ ... } ???
 
3:48 AM
@RahulDesai tru
 
@nick But then, what is ... ??
I mean in that example, not ES6 ...
 
er
I didn't even look at the original code, let me check
 
@RahulDesai It runs the two expression, left to right, and return the right part.
Nevermind, I posted an ES5 answer, and will expand it to include a cacheable code.
 
that's some pretty unreadable code right there
 
Thank you
 
3:50 AM
Oh, I don't normally do that in production. But code hacking? XD
 
haha whew
 
hey anyone here?
 
nop
 
really
it looks like you are here?
 
Anyone there?
May i ask?
 
3:55 AM
@Sheepy How would that part look like after translating to ES5?
It not clear to me yet, sorry.
!!welcome @shibly
 
@@shibly Welcome to the JavaScript chat! Please review the room pseudo-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.
 
!!welcome @JackSmith
 
@@JackSmith Welcome to the JavaScript chat! Please review the room pseudo-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.
 
Why is formdata empty? bpaste.net/show/82358dc553c7
$(this) = //Object { 0: <form>, context: <form>, length: 1 }
 
@RahulDesai don't add the @ sign in that or they get a double ping lol
 
3:58 AM
woops
 
usually cap will tell you that
 
I dint knew that.
 
0
A: To "this" or not to "this"?

SheepyYou don't need fancy objects for this. Good old closure is sufficient. function addg ( left ) { if ( left === undefined ) return undefined; return function recur ( right ) { return right === undefined ? left : ( left += right, recur ); }; } This simplisit approach create an exec...

 
get enlightened
 
@Sheepy I am still not clear with the ( left += right, recur ) part though. Can you please tell me the ES5 version of this part?
 
4:00 AM
Can anyone answer?
 
@Sheepy is simplisit a real word
 
@nick Do you know how the afk command works here?
I know its something like !!afk : message
but then what do I do when I get back?
 
user406009
@Zirak IIRC, you are the author of the Caprica bot right?
 
user406009
Some people in the Lounge are interested in creating our own bot for certain reasons.
 
user406009
Did you just use a normal account for Caprica?
 
4:05 AM
Is there any room for jquery?
 
GoT 6 Tease:
@shibly I dont think so.
 
@RahulDesai when you get back
 
@nick Should be simplistic, thanks. Fixed and added an alt solution that preserve states in each step.
 
(when you become active in the room again)
@Sheepy np, anything for u
 
user406009
@Zirak Also, is it fine if we reuse some of the code?
 
4:07 AM
I see
 
@RahulDesai ( a, b, c, d... ) will evaluate a, then evaluate b, then c, and so on, finally returning the last evaluated expression
 
Gotcha.
 
@shibly This should be the best room. While not all of us like to use it, you can be sure we can use it efficiently.
 
Why is this empty? console.log(formdata);
 
Some of us use it efficiently by not using it. ;)
 
4:10 AM
@shibly are you sure the even is even being triggered?
btw, wtf happened to js fiddle?
how do I even add jQuery now?
 
@shibly Just an FYI - use console.dir() to see objects nicely formatted in the browser console.
Although console.log('my form data:', formdata); will also do the same.
 
@Shea, $(document).on('submit','form',function(e){ triggers fine
 
@Sheepy is that evaluation synchronous or asynchronous?
 
@RahulDesai sync.
 
@Sheepy RahulDesai is afk: : foraging
 
4:16 AM
!!afk : foraging
 
I can't imagine how it can be async, really. Or perhaps that's only because I caught a cold.
 
CPU bound all the way
 
Yeah. If I don't have an urgent project to finish today I would have taken sick leave.
Apparently I was too sick to remember that I can do it from home and saves the travel time for resting...
 
vim'rs please raise yo hand .
 
o/
I think I am quite weird. I use trackball. With left hand. I use vim. In IDE. Use linux programs. On Windows. Type colemak keyboard layout. On ASDF. With four IMEs.
 
4:38 AM
I use a trackball mouse, with my laptop.
 
Good god, really?
Do you rollerskate as well?
 
It makes sense, if you're always moving around with your computer.
 
Hmm. I have seen pads and sticks, but haven't seen laptop with trackball for over 10 years.
 
Well I like to play games on my laptop, but not with a touchpad
And I like the freedom moving around with my laptop, without being confined to a surface suitable to a normal mouse.
Americans really know how to lounge
 
Well yeah, the whole keyboard, monitor mouse thing is getting a bit passe.
 
4:44 AM
Still the most diverse option
 
Roll on pure holographics and mindless hand waving
 
....And LSD?
 
No. Reality is weird enough.
 
Maybe I'm not trying hard enough.
 
Quantum entanglement. That's weird.
 
4:48 AM
Keyboard is good. It's a gamepad with 100+ keys. :)
Trackball is also good. I couldn't imagine how I could have played TIE Fighter with mouse when I was very young.
 
Yet still not enough keybinding options for my MMORPGs
:/
 
Tried them for a few years. Now turning back to single play games.
 
Excuse me for a while, I've had a sudden urge to play a board game
 
Come, let's play D&D! First challenge: read the basic rulebook which is 320 pages thick.
...... (silence)
(Honestly we usually point newbies to starter packs, which is "only" 32 pages or so.)
 
And after that they went and wrote software and didn't provide any documentation at all.
Coincidence?
 
4:58 AM
You bet :D
 
@Sheepy I see. But wouldnt it be nice if they were async? Like promise. Just a thought.
 
@RahulDesai Any example?
 
.0
is it just me or is mobile chat bugged? (open in second browser as it will hang (if it is))
 
5:17 AM
hiiiiiii
 
5:29 AM
I mean, let it evaluate all the expressions asynchronously and return the one that completes at the end. Kind of the way like promises work.
I dont have a specific coded example to show you right now.
 
@RahulDesai With promise you use .then and .error to handle the flow. How do you propose to do that with this syntax? And what happens to the remaining code, should it block subsequence code like alert until it finish?
 
Let me think about it.
 
Some languages are designed with asycn code in mind. Java is arguably the first mainstream attempt. Go is an modern example.
JavaScript, unfortunately, is not...
 
I see.
I need to spend some more time on your answer for my review question.
 
Take your time XD
 
5:38 AM
XD
 
What I wanted to say is, adding async or even multithread support is not simple. So next time you ask "why can't", don't just ask. Try to answer it.
 
Alright :)
 
You may step through it in F12 debugger. That should help you get the aha you need.
 
morning
 
o/
 
5:54 AM
@RahulDesai that should be launched on youporn
not youtube.
would suit the theme :->
 
Hi Rahul Desai !
 
@HelloWorldNoMore Welcome to the JavaScript chat! Please review the room pseudo-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.
 
@Abhishrek Thanks for the compliment :P
(secretly wishing if I could)
 

« first day (1875 days earlier)      last day (3076 days later) »