« first day (1848 days earlier)      last day (3099 days later) » 

12:06 AM
I dont agree with the conclusion
> Don’t put function declarations in blocks.
 
@rlemon He's technically correct in that function declarations aren't statements, and they aren't expressions, they're a SourceElement
 
Should be "don't rely on hoisting when putting function declarations in blocks"
or wait, maybe I do agree when I think about it
what happens if you declare the same named function in an else block?
if (true) {

    foo();

    if (true) {
        function foo() { console.log('if') }
    } else {
        function foo() { console.log('else') }
    }

}
logs else
so don't do that I guess
 
LOL
what?
how the fuck does that ..
you just made if(true) fail?
@copy @Zirak any explanation?
 
I guess since we don't have block scope, the second one always wins
 
but the second block shouldn't run
 
12:13 AM
When you have hoisting? Because it's defined per function scope
 
^
 
but..
yea I suppose that makes sense
 
it looks for something to hoist, and picks the last one
 
That's what hoisting is - moving declarations around before any code runs
 
I just expected the compiler to see the if( true ) and just ignore the else.
but yea, that makes sense
 
12:14 AM
@m59 I see you have discovered my secret repository :P
 
That requires logic, what turns code into AST doesn't do that kind of logic, and it'd be incompatible with the spec
 
I'm a glass and a half into some home made hooch, that spec is over my head right now
but will note for later.
seriously interesting for me right now
 
12:30 AM
say I'm making a lib
which is a module that people should import
how should they customize it?
have them import it into a script that calls it with options, export something, and have the modules that would use it import that?
 
sounds right to me
same way you would customize a "plugin"
you just have hooks into it with options
 
alrighty
 
12:43 AM
wow!
so alright I had this, componentWillRecieveProps
and I got a react warning
> Warning: ToolTip has a method called componentWillRecieveProps(). Did you mean componentWillReceiveProps()?
that is fucking awesome
 
12:59 AM
I think you should have used componentWillReceiveProps().
 
@Ayrit 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.
 
1:11 AM
@Loktar you spelled it wrong
 
I know
thats whats awesome
 
oh... ok
Oh, I see now
 
Usually crap like that is annoying to track down
but they have a warning for that lol
 
yeah, cool that they would account for the common mis-spelling
 
yea
 
1:21 AM
does anyone know why jquery adds an " [_] => 1446859156813" to ajax calls?
 
jquery does all sorts of stupid shit
 
@3.14159265358... cache breaker?
10
Q: Why does jQuery.ajax() add a parameter to the url?

FK82I have a data fetching method that uses jQuery.ajax() to fetch xml files. /* */data: function() { ...

 
8 messages moved to Sandbox
 
!thanks @rlemon
 
1:36 AM
Does anyone know of an effective method of throttling the scroll event? i have a handler that attempts to prevent some code from running twice, but it runs twice every time.
 
not exactly what you're looking for I suspect
but maybe helpful?
 
@rlemon i tried to use the throttle method from underscore, but i couldn't get the desired behavior (too much lag)
 
this just forces the amount of scroll per wheel turn
chrome/ff have different defaults
 
i feel i can admit this here, i've fucked up really bad on this one
:/
 
what are you trying to actually do
 
1:39 AM
dude wants the entire front end website in a single page app with parallax scrolling and history api
everything works, except the scroll is buggy as shit
 
define "buggy as shit" :P
 
i'll show you if you promise not to laugh
 
what if I promise to laugh?
 
1:57 AM
@Nick are you my ex?
 
yes
 
:( where is my guitar ??
 
I shoved it up my butt
 
jesus
just got a call from an interviewer, took half an hour. she wouldn't shut up. Seemed to want me to accept the offer before I even got it, and now apparently the executive leadership team of the company wants me to come onsite again during the work week for another onsite interview
I might just tell them to stuff it
this lady sounded like she just took a bunch of cocaine
 
Ask her for some
 
2:13 AM
> excuse me miss, I don't mean to be out of line, but are you high on cocaine? or possibly crack-cocaine? because you sound absolutely batshit crazy.
 
I've just started to use Yeoman and don't understand, is a tremendous size of the project folder normal?
For example, the folder "node_modules" is about 60 mb...
 
2:28 AM
don't worry about that
it is all server side.
clients do not have to dl that
 
@rlemon I know, but it's so many files... what a poor my hard disk :( Thanks for answer, anyway.
 
it is all server side deps. think about how large php or .net is
it isn't that much space in hindsight.
 
I understand, but there are many files, that duplicates in many projects, such as npm modules.
 
they require eachother.
just roll with it
npm isnt' perfect, but it is okay
well, that is a lie, it is shit, but I can't do better
 
How much time do you scaffold your project by Yeoman?
 
2:43 AM
I don't use Yeoman
 
Oh, sorry. What do you use instead?
 
gulp/nothing
 
Do you always begin the projects from scratch or you just have some prepared templates?
 
scratch, but I'm not the best to console about this
I have little to no workflow
 
It is clear.
 
m59
2:47 AM
@Mosho yeah, I was prowlin.
 
I'll get it out soon I hope
 
3:05 AM
Goodnight, guys (who live near Europe, of course)!
 
Hey guys, I was just playing around with map, and somehow this little code snippet ["1", "2", "3"].map(console.log) doesn’t work. Any ideas?
 
@RishavKundu 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.
 
@CapricaSix not sure if you’re a bot, but okay :)
 
4:08 AM
hello, any d3.js gurus in the house?
 
4:43 AM
+300rep for who help me out of this problem stackoverflow.com/questions/33393986/…
 
where is everyone tonight?
 
5:22 AM
@rlemon Can't sorry. They aren't speaking Hindi for sure. Might be one of the Southern languages, but I don't know enough to even recognize which one
 
 
2 hours later…
6:53 AM
@rlemon could be sri lankan or tamil
@rlemon its neither --- singapore / thai
by falconlogistics @ the van and +65
yep definitely singapore --- van has .sg
 
 
1 hour later…
8:23 AM
@RishavKundu You need to do ["1", "2", "3"].map(console.log.bind(console)) or ["1", "2", "3"].map(console.log, console) since otherwise the context will end up being the global object and console.log won't work with that context
!!mdn Array.prototype.map
 
8:59 AM
Nate Wiley made an awesome codepen api :D cpv2api.com
 
@rlemon Any opinion on your new PM?
 
Hey guys, I'm using this code:
$("#registrationForm").on('submit', function(e){

    alert("not submited");
    e.preventDefault();
    return false;

});
I have a form with id #registrationForm
On clicking the input button with type submit, it just alerts and refreshes the page.
Any idea why? I wan't it not to refresh.
 
Was the form there at the time you tried to attach the event-handler?
oh wait you said it did alert
never mind me
 
Put the prevent default before the alert
 
9:33 AM
eww alerts
@rlemon i discussed that with @BenFortune before. He was surprised that firefox doesn't hoist the function declarations in the blocks. I said that it should normally occur if you follow the specs. Why the other engines allow it is still an unanswered question so far
 
10:03 AM
@Zirak that didn't work.
@KarelG just for testing.. :/
 
jsbin.com/yutovulixi/edit?html,js,output <-- network tab confirms no traffic on submit
 
10:20 AM
1 message moved to Trash can
@BasheerKharoti Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
The anchor tag with the class delete-file is created dynamically so when calling to parent over the clicked element it throws undefined....?
$('body').on('click', '.delete-file', function(event) {
  event.preventDefault();
  console.log($(this).parent().attr('class'));//undefined ??
});
@CapricaSix : )
 
10:36 AM
Guys any idea why my page keeps refreshing even after placing this code:
$("#registrationForm").submit( function(e) {
    e.preventDefault();
    return false;
});
 
@HassanAlthaf jsfiddle
 
kk
Nvm
Found the issue.
It was a stupid mistake.
Another script was coinciding the buttons id
and causing it to mess up
 
10:57 AM
<div class="row register-item">
                                <div class="col-md-6 col-xs-6">
                                    <label for="username" class="register-label">Username:</label>
                                    <p class="error"></p>
                                </div>
                                <div class="col-md-6 col-xs-6">
                                    <input type="text" id="username" name="username" class="input-box register">
                                </div>
I have that div,
and I'm currently referring to #username
how do I refer to <p class="error"></p>
 
I do not want to refer to all error classes
There are multiple <p class="error">
I want to refer to the one which is in the same .register-item class.
 
any Angular folks online?
 
Angular is dope af
 
I am not too familiar with it
Check this
The display thing works well with css
 
11:08 AM
1 message moved to Trash can
@RanganathanSwamy Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
but not with ng-style
I did Ctrl + K that
 
Believe me I did use Ctrl + K for that code
NVM
@Hassan
 
?
I'm not familiar with AngularJS. I'm more PHP and Java ish. Not really good at JS.
 
Ohh my bad
I was typing the question
Sorry for taggin
tagging*
I am working on image gallery. I am repeating the images and values are fed to scope in form of objects. I want a button to appear on image whenever someone hovers on it and when he leaves the button should disappear.
via CSS rules one can do that by using display property but it seems impossible to use css in formal way because if I am changes to property of image selector it is eligible for all images.
Therefore when I am hovering on any image, the property changes takes place of all images and position of button is another issue, I want it to be on image only but via CSS all I know is to change position.
 
11:32 AM
0
Q: How can I create a number input that always pads to 2 digits?

Oliver SalzburgI have two type="number" <input> elements, which I want to use to let people enter the hours and minutes parts of a time value in a mobile application. By default, the two input element's value is 0, so they both show 0. This results in a display of 0:0. The usual representation however would b...

I'm confused :(
 
crl
!!> var n=1; ("0" + n).slice(-2);
 
@crl "01"
 
@crl That is not a solution to my problem
 
crl
!!> var m=12, s=9; ('0'+m).slice(-2)+('0'+s).slice(-2)
 
@crl "1209"
 
crl
11:35 AM
forgot ':'
 
@Esailija, @BenjaminGruenbaum Has mapcat ever been proposed? Can't find a positive answer, and I seem to re-implement it every second project
 
@crl Either you don't seem to understand the semantics of number input elements or I don't understand what you're suggesting
 
(to bluebird that is)
 
crl
@OliverSalzburg didn't really read, sry
 
Well... I should actually give this a try :P Maybe some magic happens which I don't anticipate
 
11:40 AM
@ivarni mdn says that that second parameter is the “thisArg”. why does console.log care about the value of this ?
 
@RishavKundu Because log expects its this to be console
 
Nah, setting the value to a string gives me an empty input :P
 
i see, the same applies for document.getElementById , but not for Math.sqrt
 
node's console for instance doesn't care.
 
Alright, I get it, is there any rationale behind choosing to send undefined normally? its not how other languages in which Ive used map work.
 
11:48 AM
@RishavKundu hrm? Whadya mean sending undefined?
 
when thisArg isn’t provided, it defaults to undefined.
 
uhhhmmm I am sooo confused about a css thing: http://codepen.io/towc/professor/qOJajG/?editors=010
Type any valid CP nick in there, wait for it to load then press surf. The div#input is still on top of the other div, even if the other one is created after so it should be on top, right?
 
!!mdn Array.prototype.map
 
What would you want it to be?
 
I need to do a comprehensive writeup on this misconceptions one day
 
JavaScript makes me want to flip the table and say “Fuck this shit”, but I can never be sure what “this” refers to.
 
crl
this is a mystery to me too (in js at least)
 
// @RishavKundu, basically:
foo.map(obj.doStuff);
// is the same as:
var cb = obj.doStuff;
foo.map(cb);
// how can cb be linked back to `obj`?
 
crl
indeed it is not, it's a reference to a function
 
11:55 AM
// let's say it's some compile time thing where functions are linked to the object they were created in.
// now what do you do in these scenarios?
function doStuff(){}

var obj = { foo: doStuff };
obj.foo();
// this is suddenly not global scope, because the function's this was tagged in creation time
 
i understand, thanks Zirak.
 
// so you say to only tag `this` when declared in objects. let's ignore complications.
// now what about:
var anotherObj = { bar: obj.foo };
anotherObj.bar();
// `bar` is just a key whose value is a tagged function, which was again decided at compile time
So it needs to be done at call time. Which is confusing.
 
perhaps it would not be prudent to say “I understood this”.
 
crl
good to know
 
It's not too terribly difficult, it's just counter intuitive
 
Ron
12:02 PM
Hi Guys, I have a question
Everytime I do a change in the DOM (add/remove class, add/remove text append/remove element etc..) it re render the page, right?
 
crl
!!> ['1'].map(parseInt)
 
@crl [1]
 
crl
@Ron via the (developer) console?
 
Ron
No, on a regular webpage, I have html and at the end the javascript code which add some classes and stuff like that
 
crl
how do you modify stuff? editing and saving your local files?
 
12:04 PM
[1, 2, 3].forEach(x => console.log(x)) , in this example what this does console.log receive? mdn says “[an arrow function] lexically binds the this value”. what is that supposed to mean?
 
Ron
jsfiddle.net/htsxoazv simple example.. it renders the page twice, once when the html is done and once after the js done
 
crl
!!> [1].forEach(x=>console.log(this))
 
@crl "undefined" Logged: "undefined"
 
crl
^ this is window in your browser, and undefined in a webworker
 
@crl i thought of that snippet too, but here aren’t you testing the value of this inside the lambda , which is not the value of this inside console.log
 
crl
12:07 PM
!!> [1].map(x=>this)
same thing
 
@crl ["undefined"]
 
Or are they the same? I am not sure.
 
crl
but I didn't completely understood Zirak's explanation, and how it relates to the above ^
 
This is hairy stuff.
 
There's no relation between the caller's this and the calle's this
 
crl
12:11 PM
callee's, ok
 
function foo() {
  // my value of this
  bar();
}
function bar() {
  // and my value of this
}
// are unrelated
 
That means crl’s snippet tells nothing about this inside console.log, am I correct ?
 
When you do console.log(crap), log's this is set to console. That's intuitive.
What crl did is show what's the this inside of the map callback
//what the arrow does is this:
function foo() {
  var that = this;
  // my this value equals to
  crap.map(x => {
    // my this value
    this === that;
  });
}
 
@Zirak not yet. I didn't vote liberal. We'll see.
 
crl
but you need to use new ? ^
 
12:16 PM
Why would you need new
 
crl
var b=function(){this.x=2;console.log(this)}, b() and new b() show completely different things
 
Correct, because new sets a this value.
 
aaa, too complicated for me, thanks for trying to explain @Zirak
 
What don't you understand?
 
How magnets work.
 
12:19 PM
Learn about the electromagnetic force
 
I don't wanna listen to no scientists. They be lying and getting me pissed
 
yesterday i ask question how to create popup box and in short i want a simple slidder some one has give me showmodal() but it is depreciated after i search it. then the question is same please tell me how to make lightbox effect simple tutorial?
 
there is literally thousands of lightbox tutorials online
 
@rlemon yeah i found a lot but i don't want thousand of lines of code i just want a simple one, because at initial i just want to understand it.. then make it attractive.
 
12:26 PM
web design in 1996 was perfect
 
crl
!!mdn console
 
@rlemon Remember site maps?
Remember <map>?
 
crl
console is some whole object living completely outside from window? well nvm, doesn't change
 
@Zirak totes. remember image maps being the shit!! ahh the good old days
 
12:32 PM
@crl Sometimes they share spit
 
crl
why this ['1.2'].map(Number.parseFloat) would work and not [1].map(console.log)
what's the sorcery behind console?
 
It's not sorcery
It just expects its this to be console
 
its because console.log wants this to be console
 
crl
there's a if (this!==self) return 'fuck you' in console source code? :)
 
crl
12:36 PM
and why with(console){[1].map(log)} still wouldn't work?
 
let console = {
  log () {
    // I do something with this; if you pass me and do not rebind me I'll take a dump.
  }
}
 
42 mins ago, by Zirak
// @RishavKundu, basically:
foo.map(obj.doStuff);
// is the same as:
var cb = obj.doStuff;
foo.map(cb);
// how can cb be linked back to `obj`?
 
crl
ok, just function passing
 
You've just complicated the obj.doStuff part, the rest still stands
 
12:39 PM
good morning awesome folks of the js land
 
crl
gm
 
( ͡°╭͜ʖ╮͡° )
 
@Zirak huh?
 
@BenjaminGruenbaum Promise.map : arr.map :: Promise.mapcap : arr.mapcat
Have a way to give an array of array of promises
 
oh, like clojure
 
12:53 PM
Or any language with decent array constructs, yeah
 
well, clojure is the only one who calls it mapcat that I know
 
Call it mapcar if you're into the lispy roots
Or mapcons
 
well, it's kind of weird because promises already have a flatMap, then.
So a flatMap is like a flatMap inside an operation that's already a conceptual flatMap.
 
Promises have a flatmap?
 
Promises are a flatMap :P
 
12:56 PM
@rlemon hi dude
 
oh, I see what you mean
 
What's the signature of flatMap? M a -> (a -> M b) -> M b
with lists that's [A] -> A -> [B] -> [B] - that's concatMap.
With promises that's Promise A -> (A -> Promise B) -> Promise B - that's the signature of then.
Although since we have map for arrays a flatMap might not be too bad.
 
Worth opening an issue?
 
@maytham-ɯɐɥıλɐɯ hello
 
@rlemon are you there?
2
 
12:57 PM
no
 
ninja'd
 
;)
@rlemon you remeber i talked about your nice webi
 
no, but okay
 
crl
!!urban webi
 
@crl No definition found for webi
 
12:59 PM
ok, I liked you page, and would like to do some thing similar is it ok with you I get the could backgorundish thing?
 
view-source
 
@Zirak go for it let's see what petka thinks
 
I know, but i am asking for permission
 
sure
 
coolish man,
enjoy you weekend so far
 
1:02 PM
> How do i disable view source ?
 
google.com
or stackoverflow
 
crl
eek, there are var React = require('react'), DOM = React.DOM and ReactDOM = require('react-dom') confusing github.com/mhart/react-server-example
 
Scala has the scariest API docs scala-lang.org/api/current/…$FlatMap
 
crl
1:14 PM
 
@crl they don't have enough to write
 
they wanted to remind us browsers had a zoom setting
 
crl
good point :)
 
1:33 PM
Fuck sake, statutory redundancy got denied. I'm so fucked.
 
@BenFortune What's that?
 
@Zirak Company went into liquidation so I got made redundant. The company can't pay me so I have to claim it from the government.
 
@BenFortune Why was it denied?
 
@Zirak Need to be in continuous employment for 2 years minimum, which I was. But my contract changed half-way through and moved me to a different part of the company
Which is just fucked up
 
1:39 PM
That's...stupid
@rlemon As was that
 
@rlemon What the hell sort of question is that?
 
I could have easily answered that
 
America ruins TV
 
has he never been to an ikea lol
 
He thought it's a stupid answer
Because it is
 
1:42 PM
it's a stupid question
but anyone who has ever gone to ikea has a decent chance of answering that
gone to = ate at
I guess
 
> Who was known as the Mutilator?
> 1. Genghis Khan
> 2. Rosemary West
> 3. Alexander of Macdeon
> 4. @KendallFrey
Little did he know that @KendallFrey is the Ass Mutilator
 
@Mosho He even said he knows they serve meatballs at ikea though
 
really
 
I guess logic isn't on the curriculum in med school
 
He did the correct quiz show thing. There was a stupid answer. He ignored it. He out-smarted the question and lost.
 
1:47 PM
And I usually got to Rome to look at kitchens I can't afford... not saying the question wasn't dumb, saying the guy was.
At least he took it well
 
<script type="text/javascript">

$(document).ready(function(){
  $("a#show-panel").click(function(){
    $("#lightbox, #lightbox-panel").fadeIn(300);
  });
    $("a#close-panel").click(function(){
    $("#lightbox, #lightbox-panel").fadeOut(300);
  })
});

</script>
 
@rlemon i know that format, but that question ? The crew probably thought that the answer could be logical. (deduction)
 
i have that function it show an error $ is not define??
 
did you forget to include jQuery?
 
copied from somewhere else ?
 
1:53 PM
it is link in his tutorial he is not include any jquery plugin
 
> I had many options to choose from available jQuery plug-ins however, the idea was to optimize the code with minimal use of heavy third-party scripts and CSS.
 
@SajjadKhan yes he has
the demo has an external resource
 
@rlemon it is dude painful he should have never talked to much about being smart
 
also, it is understood that was jQuery code and you need to include the jQuery library
 
1:56 PM
it's from 2009 ...
 
it is the demo link I'm not found at stage he use external resource?? Is he? please mention the line number
 
it is visible in the image above
 
._.
 
@KarelG Bet you $4 in a week's time the question will turn into how to call php function from lighttable event
 
1:58 PM
codepen, like most prototype website, has an options menu which allows inclusion of third party scripts
but this is all moot
 
haha
 
> So I created the light-box effect with a few lines of code using CSS and jQuery.
he explicitly tells you it is jQuery
how do you use jQuery without including it?
use common sense.
 
How Can Jquery Be Real If Our Selectors Aren't?
 

« first day (1848 days earlier)      last day (3099 days later) »