« first day (2110 days earlier)      last day (2836 days later) » 

9:00 PM
That site is going to get me fired
 
I need to get the hype rolling
tweet it and shit
tell yo friends.
 
I don't tweet :(
 
tweet it dammit
 
@SterlingArcher print out QR codes and post it in bars
I'll make a TV app
fun for the whole family
 
QR codes in bars just look like gray boxes
@rlemon if it loads up on the Xbox, I might be able to turn it into a party game
 
9:02 PM
@rlemon reddit.
imgur usersub.
 
@Neal not until it is finished
someone else is finalizing the UI for me
responsive and shit
 
;-)
Just use foundation or bootstrap :-) cheat a little :-P
 
when are you gonna do ads?
 
once it is done.
one single text ad at the bottom
 
make bank
 
9:03 PM
Guys I'm a big deal
 
I don't like image ads or ads that potentially play video/sound
 
Hi big deal, I'm Harrison Ford
 
!!afk holy shit it's 5:03
 
I don't like ads that break mobile browsing
 
@rlemon Whoa... when did that happen?
 
9:04 PM
I don't like ads
 
You need a good favicon @rlemon
 
Nice, home time
!!afk doing the traffic
 
why do the traffic when you can take the poor box?
 
I left my knee brace at home... gonna try to run without it. We'll see how that goes...
 
!!weather sunnyvale
 
9:13 PM
@RahulDesai [object Event]
 
!!weather night vale
 
@ShotgunNinja [object Event]
 
!!weather [object Event]
 
@ndugger [object Event]
 
anyway its hot here :P
 
9:18 PM
!!>new Event('weather')
 
@nderscore {"isTrusted":false}
 
oop aww :(
 
9:29 PM
damn. downvote limit again. i hit 30 way too fast
 
@Neal I do
 
@rlemon k cool :-)
 
k
 
3
Q: Are nested functions a good practice in JS?

victor175If I have a longer function in JS, lets say: var myFunction = function() { /* ... too much code here ... */ } I am used to extract small pieces of the code, which are specific for that function inside the function definition, in order to increase the code clari...

Good question.
 
for programmers
not SO
 
9:41 PM
people that do var foo = function () { ... } instead of function foo () { ... } are the scourge of the earth.
 
@ndugger And why is that?
You are not a fan of hoisting? ;-)
 
Nobody should be
but it also leaves your functions nameless
 
you can name the functions
 
you could do var foo = function foo () { ... }
but pls
 
and how does that help with 'hoisting'?
you then get some strange variable hoist without the function
it acts completely batshit crazy
your argument is invalid
 
9:44 PM
who's?
 
Neals
 
@ndugger What is wrong with nameless functions?
 
@Neal have you ever written any javascript ever?
 
@Neal anonymous functions have a place, and they are wrong in other places
 
@ndugger Yes. Yes I have. I never learned what makes a named fn better than an anon.
 
9:44 PM
debugging
 
you can reference it
 
@ndugger hmmm but you have the stack trace, no?
 
poop(function() {
  arguments.callee?? pls
})
 
it makes debugging better
jesus; stop advocating for bad practice
 
I guess it just bad of me to rely on the stack trace then?
 
9:45 PM
what the fuck
I'm done
time to go to the gym
 
ok.
 
@Neal stack traces on anonymous functions don't look good in all tooling
 
There is a pikachu @ the gym
 
Chrome only recently (last two years) got it right
 
@rlemon That is true. But most modern browsers (ahem Chrome) display it kosher.
Wow it is late.
gtg head home.
 
9:46 PM
it isn't guaranteed
 
@rlemon True.
Lesson learned.
 
just like radix. we always pass to parseInt
but nevertheless that shouldn't be the reason to always name your functions
 
Although I usually try to maintain the current coding standards. so if it already has the var name = fn stuff I keep to the paradigm
 
like I said, there is a time and place, today you would just use a lambda expression where you don't really care
 
true.
 
9:48 PM
yes, when working with other people's code, follow their practices.
 
but think about functions as callbacks
 
ahhh heading home. Stop chatting Neal.
 
if you want it to be recursive, or be able to be referenced again, you have to name it
 
@rlemon ok?
@rlemon Yes, that is true :-) But it can be named through a var reference, no?
 
if you've declared it before you use it
many people inline them
 
9:49 PM
var myFn = function () {...; myFn(); ...}
that does work
 
poop.addEventListener('click', function poopy() {
  poopy();
});
the downside of the var approach is I have to define my functions before I use them
that is a limitation I'm not okay with
 
const poopy = function () { poopy(); };
poop.addEventListener('click', poopy);
Yes, true.
But it lets you set the context of it.
you are in control :-)
 
if you "like hoisting" like you mentioned above, you probably like function hoisting
not variable hoisting
and how are you in more control?
 
maybe. I always forget the differences.
 
function() {}.bind(poop)
 
9:51 PM
I cannot remember all of my fn principles.
 
when you get home you can come back and I can answer any function questions you may have :D
 
I see some code that insists on using the lambda syntax wherever possible, which I only use for inline anonymous functions.
 
10:15 PM
Btw if you're team instinct you can get a lot more xp from a lucky egg by battling gyms
It'll work with other teams if the area is competitive enough, but I've had trouble with it as a mystic
If you have a super uncompetitive gym, you can put a high level magikarp in and train it with something less than half its level
I don't think it's higher xp/hour than evolving pidgeys though
 
10:53 PM
Hey guys
 
@FudgeMuffins 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.
 
Is it true that tradings going to be implemented soon?
for PoGo
 
afaik nobody knows for sure, but Niantic hinted as such
they would be fools not to
 
11:22 PM
i'm trying to use map filter reduce on http.get
and it keeps getting my undefined
even though i see the array in the console
but the filter doesn't see it
do i need to parse it or something?
 
need to see code bro
 
@BenGeorge 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.
 
this.http.get('friends.json').map(res=>res.json()).filter(res=>{return res.id=== 10}).subscribe(record={x.next(record)})
res.id always give me undefined
though i can see the res as an array of all my friends
no issues with that
 
What library is this http thing from ?
 
angular2, i'm guessing?
 
11:29 PM
yes angular2
yep
filter is messed up and not seeing res.id , when i put a console.dir(res), i get the array of all friends
what am i missing here
 
@JoeSaad are you able to confirm that your request to friends.json is returning data? maybe check your network traffic?
 
yes
it is returning and i can see all the array
the filter is not able to do the res.id thing...
 
the problem is you're filtering the entire array, not the elements of the array
 
res is an array
 
right
 
11:31 PM
ok, how do i filter the elements of the array
i know i'm missing something.. can you help me know what i am doing wrong here
thanks
 
this.http.get('friends.json').map(res=>res.json()).map(res=>res.filter(resItem => resItem.id === 10))
that's sloppy, but will probably work
your subscribe is weird, though
remember you pass it a function
and, since you're not creating an Observable yourself, you're subscribing to the Observable that is returned by filter, you don't need to call x.next(record). Just work with record.
//actually, this is probably what you want:
this.http.get('friends.json')
  .map(res=>res.json())
  .map(res=>res.filter(resItem => resItem.id === 10))
  .flatMap(resArr => Observable.from(resArr))`
  .subscribe(result => {
    //use result
  });
//this will emit each element in the `res` array to your `subscribe`
 
ok, i'm trying it now
@NathanJones it worked
thanks a million
that was quick..
the function is a little unreadable though but it works
 
@JoeSaad I would format it so each operator is on its own line, and moving the flatMap would make the filter nicer to read.
//so something like this instead:
this.http.get('friends.json')
  .map(res => res.json())
  .flatMap(resArr => Observable.from(resArr))
  .filter(resItem => resItem.id === 10))
  .subscribe(result => {
    //use result
  });
 
what is the flatMap there for?
i'm using it without the flatmap and it's working so far
 
if you're okay with result being an array, you don't need the flatMap
 
11:44 PM
no, i actually want the result to be an object rather than array
 
@JoeSaad have you used flatMap before?
 
Just trying to get some understanding of how this works....

uib-typeahead has a template with the following: `ng-style="{top: position().top+'px', left: position().left+'px'}"`.

I can't see a function 'position' on the scope of the uib-typeahead directive. Where is this `position` function coming from ? I think it is coming from uibPosition service but how is that even reachable ?

Code: https://github.com/angular-ui/bootstrap/blob/gh-pages/ui-bootstrap-0.14.3.js
 
no
 
cool
i remember being on this page before
 
11:48 PM
@JoeSaad does the concept make sense?
 
i'm trying to apply it now and see if i understand
e.http.get(...).map(...).flatmap is not a function
just got this error when trying to apply the neater code you sent
 
are angular2 observables == rxjs observables?
 
yes
import {Observable} from 'rxjs/Observable';
 
hmm...what does your code look like?
 
the DNC makes bad background noise.
 
11:56 PM
what version of rxjs are you using? if it's super old, it might not have flatMap
5 beta is recommended
 
got you
that's the package i'm using rxjs@5.0.0-beta.10
is that super old?
 
no, that's good
 

« first day (2110 days earlier)      last day (2836 days later) »