« first day (1634 days earlier)      last day (3313 days later) » 

8:01 AM
@RahulDesai the media queries still working even the content=width=1300
 
what is that you try to achieve.
 
THE
any idea why zoom is not working here anyone ?
 
caprica could have !!git stat kewinsawicki and show github.com/users/kevinsawicki/contributions oneboxed
 
@argentum47 Yep, feel free to PR. :)
 
THE
no zoom working here
 
8:05 AM
@THE ReferenceError: vis is not defined
 
@IonicăBizău nice to see you again :))
 
look at console..!
 
THE
:O
i never dated vis before
 
@argentum47 Yeah, I was looking at the traffic stats on that repository... and found some interesting discussions here about it.
 
I see.
 
8:23 AM
0
Q: Angular material icons animation not working

SajeetharanI am using angular material icons in my application, icon works fine, but the animation using morpheus script dint work. What is the problem? Code: <md-item-content md-ink-ripple layout="row" layout-align="start center"> <div class="inset"> <ng-md-icon options='{"dura...

 
so has anyone here ever touched google closure in their life? Am I the only way who thinks that JavaScript as it is, is stupid and that we just spam website with libraries of which we actually only need two methods. Anyone here cares about performance? Clean code? On some websites only like 1% of the JavaScript code is used right.
 
@mash Almost everyone here cares about clean code and performance.
 
^
 
That doesn't mean Google Closure is a good idea though :-P
 
^!
It was a step up from GWT at least
But personally I only ever used the closure compiler for minification on a few projects
 
8:32 AM
@mash I can't tell if you're for or against Closure Compiler
 
user3949359
Why would I want to add a property via the constructor instead of just doing obj.prop?
 
Not sure that Closure really contributes something
 
Lo all :)
 
I feel like nearly no one really looked into google closure.. like nearly no one on the web talks about it.
 
Canonical candidate: How to create a bunch of images from an array of paths/details.
I've seen a few of these questions, they all use document.write. Anyone wants to write a better one for 500 bounty?
 
8:42 AM
@mash Google Closure does nothing better than other tools. That might be it?
 
@SecondRikudo Cut + Paste + Document Fragment?
 
@monners Map to image objects, append to the DOM
Use CSS to make it look presentable
Currently the accepted (and highly voted) answer on at least 3 questions advocates the use of document.write() to do it
 
Effort... Loop, append to doc fragment, append to dom, pretty with width: Xpx; height: auto
 
@monners Why is there a need for a document fragment in this case?
Why not append to DOM directly?
 
@SecondRikudo There isn't, but it's more efficient than hitting the DOM every iteration. Hitting the DOM is expensive, unless you actually mean to load everything in cannon
 
8:45 AM
Isn't it generally not a great idea to append directly to DOM in a loop?
 
@RoelvanUden well you manage code by dependencies. It's really easy to debug. When compiling for production it'll remove all unused code paths. It supports ie6. You can do awesome unit testing. etc.
 
@monners vOv
So what do you say? Willing to write a Q&A about it?
Will almost surely bump you to 2k :)
 
@mash Using bower and UglifyJS gives you that too, without funky Java containers.
 
Sure.
 
Make it a good one :)
 
8:47 AM
I'll try... Is there already a Q out there, or are you about to post it?
 
@monners You post it
You can write it in a gist first (both question and answer), and post it here for review before posting it on SO
 
user3949359
what is an interface in JS?
 
kk
 
@nosille Same thing as it is in any other language, only less enforced.
An "interface" is a concept, it tells you what methods an object has implemented
 
Well I don't know if JavaScript itself got interfaces but google closure kind of supports them: developers.google.com/closure/compiler/docs/…
 
user3949359
8:51 AM
@SecondRikudo "One useful thing to do with objects is to specify an interface for them and tell everybody that they are supposed to talk to your object only through that interface. The rest of the details that make up your object are now encapsulated, hidden behind the interface." What does this paragraph mean?
 
@nosille That part is less applicable to JavaScript, but imagine the following scenario
Let's say your application does some logging as part of routing work
Your functions/objects accept a Logger object as a parameter
 
@nosille That you establish an object with methods to be called by the library, without knowing how the library does its job
 
But Logger could do anything under the surface.
 
@RoelvanUden you got your point if you confirm that bower will really remove unused code. I guess I havn't looked into it that deep yet.
 
It could call a file, send an AJAX request to a logging server, log to console, do nothing at all
All you care is that it's an object and that is has the .log(message) method
 
user3949359
8:53 AM
@Neil that's encapsulation, but where does the interface come in?
 
The interface is a tool to make sure objects have that .log method you expect.
For example, in PHP:
 
@nosille It's reversal of responsibility
 
class FileLogger implements Logger {
    // Now FileLogger must implement the log function.
}

interface Logger {
    public function log($message);
}
 
Rather than you calling the library, the library calls you.. but in order for that to work, you have to agree on what methods to be called
In soviet russia..
 
And your application relies on Logger in place of the FileLogger, that means that the application doesn't care which logger it is, as long as it is a logger.
 
8:55 AM
@mash Not really. Removing all unused code is pretty much impossible. Google Closure isn't clever enough to figure out what I use from jQuery for example, anyway. I just tend to minify optimize and bundle and that's the best you can reasonable do.
 
What @SecondRikudo is referring to is an excellent example of an interface in general
 
@RoelvanUden I'm pretty sure Google Closure is clever enough to figure out I'm not using jQuery at all and remove it altogether :P
 
@RoelvanUden really? I think google closure is clever enough to do that
 
Let's differentiate between "google closure" and the closure compiler. Google closure is a lot more than just the compiler
 
Only static paths it can figure out. It can't handle dynamic nature very well.
 
8:57 AM
No google closure is still pretty bad at compiling 3rd party stuff in.. only nicely annotated code will be optimized perfectly. For 3rd party libs you would need externs and then you'll have the full method names and everything of that 3rd party lib even in the compiled code.
 
then use uglifyjs
 
using uglifyjs after compiling with the closure compiler seems like a good idea if you need a third party lib.
but still it won't remove unused stuff of the 3rd party lib then... so it's nonsense if google closure then for real and not fake.
 
@monners -1 for loop
 
le sigh
This is for beginners, right? I could rewrite it with a map if you'd rather
 
9:07 AM
@monners also, didn't know if you knew, but you can have multiple files in a gist
@monners forEach, no need to iterate twice
 
kk, gimme a sec
 
@monners Also, @imageContainer did you mean #imageContainer?
 
Yes. Yes I did. I noticed that as soon as I hit save :P
 
Also, why document.createElement('img') over new Image()? (Not that it matters much, the latter is just more readable in my opinion)
 
Good luck @SecondRikudo :)
 
9:12 AM
@BenFortune Thank you :)
 
@SecondRikudo I'm not a huge fan of the new keyword. Crockford beats me every time I think about using it...
Oh crap, I totally forgot to use jQuery!
 
So people complain about === while I just learned that Java actually throws an NPE when it tries to auto-unbox null, that was a fun debug-trip
 
You could add a jQuery solution at the bottom "And if you already use jQuery, you can do it like this...."
 
@SecondRikudo I'd rather not?
 
9:17 AM
@ivarni The fun thing about Java is that it is the only language in existance that throws NPE while not having pointers.
@monners vOv
@monners Can you try formatting the problems of the first approach as a list?
 
@SecondRikudo As in a markdown list?
 
> However, there are several problems with that approach:

- It uses a for loop
- It queries the DOM a lot
- etc
@monners Yes
@monners Also separate them into two files on the gist XD
 
Hey :) good morning.
 
why does jslint urge to write function () instead of function()
 
@SecondRikudo Hmmm, now that's something I've never done before...
 
9:24 AM
@argentum47 jslint does a lot of very opinionated things, it's not nesescarily a good reason for everything
 
ow, ok
 
@argentum47 if you google the error message it gives you you'll usually come across some kind of explanation though
 
@BenjaminGruenbaum Hey, how can I make a promise waterfall using bluebird?
 
Err, forgot to copy paste
 
@argentum47 And don't forget the warning message to the top right on jslint.com/lint.html ;)
 
9:27 AM
:D
 
brb, phone call
 
I am using a twitter bootstrap carousel for showing images. I am now trying to add when you click a thumbnail that the image changes. jsfiddle.net/duikboot/h6md3ytt
This is what I tried so far. but it's not yet doing whatI want :(
 
And what is it you want?
 
@SecondRikudo Ready when you are
 
@BenjaminGruenbaum Got it! :) Thanks anyway. Using promises in production for the first time. :D
 
9:32 AM
@monners Looking good, go ahead and post it
If we have more fixes we'll do it live :P
 
0
Q: Add a list of images to a document?

monnersSuppose I have an array full of image source URLs, like: var imgs = ['http://lorempizza.com/380/240', 'http://dummyimage.com/250/ffffff/000000', 'http://lorempixel.com/g/400/200/', 'http://lorempixel.com/g/400/200/sports/']; How do I grab all of those images and insert them into my page at a p...

2
 
@monners You should have used the insta-self-answer feature, but no matter.
Just post the answer normally
 
I'm amazed there isn't already a good answer to this exact question
@SecondRikudo Thanks for the opportunity BTW. Much appreciated.
 
@monners You're welcome :)
 
@RoelvanUden I want when I click the thumbnail that the large images change to the one that is being clicked.
 
9:46 AM
The power of google closure: gist.github.com/mashify/67fce95e97e75e478d86
 
@mash It's cool that it can optimize away the isHungry call but that's just the compiler, a minor part of google closure, it's easier for people to know what you're referring to if you specifically mention the compiler. I've assumed you were talking about the entire toolkit the whole time
 
I was
 
Right, then that gist only shows the compiler is good, it doesn't say much about the rest of the toolkit
 
There's also some CSS extensions IIRC
 
9:54 AM
I refuse to use the CSS stuff of them... it's not that great in the end.
 
and a widget library?
like I said initially, all I ever used was the compiler :)
 
is under more
 
@Mahesha999 How is this JavaScript related?
 
1 message moved to Trash can
He's asking everywhere. Particularly annoying. Ask where it is relevant.
 
I know its not JS related...sorry if this is STRICTLY js, but everyone uses some sort of svn
and github is profound
 
9:55 AM
I also wear pants, but I dont ask about them here
 
lol
 
@ivarni Don't be harsh
@Mahesha999 it's not that we're strictly JS, it's just that it's extremely unlikely you'll find help here.
 
@SecondRikudo Was actually trying to be funny, but point taken
 
Have you considered opening a ticket on their GitHub repository, asking it there?
 
kendoUpload master here?
anyone who knows how to dominate that component?
 
10:04 AM
@SomeGuy Have you read Ready Player One?
 
@ivarni I mean the css class minification is still awesome and should be used.... and that is also a part which I haven't seen anywhere else but I don't like the closure stylesheets. It's pretty strict but I understand why... performance. right to left css selector stuff etc.
transforming complex css selectors into classes that will be added on the correct elements in soy would be the perfect solution.
 
@mash Thing is, if I have to tightly couple every piece of my application for something like that to work I just don't think it's worth it. css class minification sounds super scary to me.
 
@mash Not practical.
 
@ivarni yeah it's all scary but also awesome... you can save soo many bytes and make a website so lightweight.
 
You'll have to have a minifier to do all of your HTML/CSS/JavaScript combined, and even that doesn't solve problem that could arise from the server side.
 
10:09 AM
but it's already there and working....
 
@mash Unlike what many people think, saving even 20% of the bytes won't result in a 20% increase in performance.
TCP/IP works by exponentially increasing transfer speed until packets are lost
 
soy templates minify css classes, in javascript the classes will be replaced with some kind of constexpr method and in css closure stylesheets (they give you maps so you can write own alternatives)
 
What matters more is the number of requests you make.
 
THE
Look what have i made :D - jsfiddle.net/nhe613kt/49
 
@THE Nothing?
 
10:11 AM
@SecondRikudo but after the google pagespeed rules you should inline the above the fold css that would make it even faster and minifei css classes gonna help you out there too
 
@mash There's no such thing as CSS classes
They're HTML class names
 
@mash But performance is about so much more than saving Bytes. I'd only start caring about those last few Bytes once every single other piece of the entire system is optimized to perfection.
 
so rest of css will be loaded async and javascript will be loaded async too so only one request to look at the page
 
CSS hooks to them, sure, but they are tools primarily meant for the semantic value of the HTML document.
 
THE
@SecondRikudo its a d3 matrix
 
10:13 AM
@SecondRikudo alright I'll use the correct name in future
 
THE
I want to add list items to d3 rect
 
@mash It's not just the name
 
THE
but can't seem to find a way
other then inject divs
 
don't discuss with me something as minor as the difference between JS and JavaScript
 
@mash I'm telling you it's not the name that matters...
It's what you use class names for...
 
10:15 AM
I understood. thanks
 
If you use class names just as CSS hooks, you're almost surely doing it wrong.
 
THE
oh am i :'(
 
CSS hooks means that you add them to HTML so that you can style them with CSS? Well I use them as JavaScript hooks too. But yes they're only hooks for me. I won't add a class which does nothing in the end.
anyway... it's fine... I was just hoping to inspire some people to look into it a little deeper. But I understand... effort vs. benefit. Only companies like google seem to have enough time to develop their systems with stuff like that.
 
@mash Just because someone isn't over the top excited about something doesn't mean they didn't look into it or understand it
 
sure... and I understand but that's fine
thanks for being so open and actually discussing it with me :)
 
user2620028
10:31 AM
Hey guys. I am having trouble accessing the html text content of a div and replacing it by CSS content:'';
 
user2620028
 
I am having trouble setting style of Leaflet geoJSON layer
0
Q: Cannot set style on leaflet L.geoJSON layer

vamsiampoluI am having a bit of trouble setting the style on a L.geoJSON based layer,my code looks like this: var addProperties = function addProperties(prop,map) { //the API does not seem to support adding properties to an existing feature, //the idea here is simple: //(1) currentFeature.toGeo...

 
user2620028
What am i doing wrong here. just the normal content:'asdf'; will put the content in a different place than the content that is already there.
 
@HatterisMad you have no JS, so its not at all wrong
 
user2620028
 
user2620028
10:34 AM
@argentum47 i am aware i would normally change that with js. I am in a scenario where it is going to be changed with css however and I am honestly stumped as to why it is exhibiting the behavior it is.
 
ohh great so what's the intended behavior?
 
user2620028
To replace the text that is in the html markup with alternative text provided in the css
 
on what event?
 
user2620028
on css parsing to display to the browser
 
user2620028
This is a knowledge gap of mine i am trying to find the answer to. I found this problem and I don't know how to solve it
 
10:38 AM
ok just change the html to the text you want it to be then because it seems like nonsense to do that in css or javascript
 
user2620028
It is nonsense. However that is not the point. The point is to try and understand why css is behaving the way it is, not to get the right text in there
 
THE
what does push really means :/
 
user2620028
in javascript performed on an array element it means add to the end of the array
 
still no idea what you want: jsfiddle.net/cmdc52x5/2
 
THE
@mash you are such a troll - haha
 
user2620028
10:44 AM
mash you cant change the html
 
user2620028
That is kind of the point
 
you can't just remove text in an html document by changing the before content
 
are punned object literals on the roadmap in javascript? As in, ({x,y}) being equivalent to ({x:x,y:y})
 
before doesn't mean between this and the previous element
 
user2620028
I am well aware mash
 
10:46 AM
So you can't make Random text disapear
 
user2620028
Is this problem stumping you as well as it is me then? Judging on you having to change the html to come to an answer.
 
no you can put a white element on top of it
 
user2620028
That random text should be the content:""; of the example class however.
 
and without changing html I'm pretty sure you can make before absolute and let it appear above random text
but that's all nonsense and belongs in the css chat anyway
 
user2620028
You didn't have to engage it if you didn't want to
 
10:49 AM
I know :) but I would just say removing text which is not in an element out of the html (hiding a text node) is not possible as far as I know
ohh wait it's possible
give me a sec
 
user2620028
the text node is not the content for that div?
 
user2620028
Oh crap i just realized that content only worked with before and after lmao
 
user2620028
hacky but does solve the problem
 
user2620028
I will accept that as a valid answer lol.... I can't believe i never knew that content only worked on pseudo selectors
 
10:59 AM
Is codewars having issues right now? I've removed literally all of the code from my function and reloaded the page and it's still timing out.
 
codewars is nice.
 
user2620028
argentum that is essentially the same work around that mash suggested -- also to use the display:none the html requires modification from what i originally had.
 
Hi
I answered many answers on SO
I am searching for a particular answer which has ":after" string in it
how to search this?
 
I am new to Apache Cordova dev. I am trying to execute this query but, I am confused why onSuccess and onFailed are both fired?
tx.executeSql("CREATE TABLE IF NOT EXISTS Product(Id unique, pname TEXT)", [], onSuccess("executed create table"), onError(tx))
 
11:08 AM
@Mr_Green the one where you count stuff? :D
 
@Marek I guess it failed to execute the string :-)
 
@Marek are onSuccess and onError closures?
 
Looks to me like you're invoking both the functions instead of passing referencens, unless there's something magic about cordova I am unaware of
 
good call... except if they're closures
 
11:17 AM
you mean if they're higher order functions?
 
closure = function referring to variables in its outer scope
higher order function = function accepting a function as its argument and/or returning a function
 
guys, in a selenium + protractor tests i'm trying to get the count of tabs by browser.getAllWindowHandles() but this is returning undefined is not a function - is there another way that I'm missing?
 
ohh in that case higher order function I guess
interesting...
so the a closure is the function returned by the higher order function
 
@ivarni Thanks. I have changed the call to 'onSuccess, onError' and everything works just fine. I have invoked both functions as you suggested.
 
because higher order functions always return closures otherwise it makes no sense to return a function right?? or what would another use of a higher order function be?
 
11:24 AM
They can accept a function
 
ohh right I forgot
 
once it stores that function somewhere, though...
UB in C++
 
@monners coincidentally I had written a nice little script that did exactly this, based off this question I had a while back
 
44 mins ago, by Jan Dvorak
are punned object literals on the roadmap in javascript? As in, ({x,y}) being equivalent to ({x:x,y:y})
 
@mash currying? I'm a bit on thin ice now though
 
11:31 AM
?
 
as in I never fully understood the difference between currying and partial application
In mathematics and computer science, currying is the technique of translating the evaluation of a function that takes multiple arguments (or a tuple of arguments) into evaluating a sequence of functions, each with a single argument (partial application). It was introduced by Moses Schönfinkel and later developed by Haskell Curry. Uncurrying is the dual transformation to currying, and can be seen as a form of defunctionalization. It takes a function f(x) which returns another function g(y) as a result, and yields a new function f′(x,y) which takes a number of additional parameters and applies them...
 
@ivarni I think they're basically the same thing
 
@ivarni still a closure.
 
@JanDvorak but the function that does the currying/partial application is surely high order?
 
sure is
it also returns a closure
 
11:34 AM
oh right, yes
 
stop it I felt embarrassed enough by not knowing what a higher order function is
 
No need to be, you probably knew very well what it is, just not what it's called :)
 
THE
how can i add some text to this red rectangel ?
var bar = svgContainer.selectAll("g").append("text").attr("value", "Hahaha");
this doesn't work - jsfiddle.net/nhe613kt/57
Neither does this

var bar = svgContainer.selectAll("g").append("text").text("Hahaha");
 
bjb568 is running for mod :D
 
THE
@BenjaminGruenbaum i will vote him if...
 
11:45 AM
is there a decent way to have private members in es6 classes?
 
@THE whatever ... means, wrong answer
 
Guys , Why .insertBefore() doesn't work on Firefox ??
 
@BenjaminGruenbaum seriously? lol
 
@Bassem most likely your fault
 
@Mosho no
 
11:46 AM
@Mosho Y U NO READ MY ANSWERZ?
 
20
Q: Private properties in JavaScript ES6 classes

d13Is it possible to create private properties in ES6 classes? Here's an example. How can I prevent access to instance.property? class Something { constructor(){ this.property = "test"; } } var instance = new Something(); console.log(instance.property); //=> "test" ES5 Fiddle: http://ww...

I did :D
 
Oh look, there's an answer saying you can.
Wonder who's the asshole who wrote it
 
That's not a decent way :P
It's a way.
 
I don't want to have symbols in a closure
it's not decent
 
Why? Symbols are designed for this exactly, their syntax isn't hard.
Why closure?
Also, why are you looking for private members anyway, just prefix with _ like Python it'll make your debugging life a lot easier anyway.
 
11:48 AM
property is in a closure
 
uhh... no
 
what no
 
Also - Privates are about conveying intent and not security anyway here, so just agree with Sahar.
You don't need a closure for a private property with a symbol.
 
no suffix _
 
but it's a closure right there
of the constructor
 
11:49 AM
Oh, you mean in my answer?
 
yeah
 
Because it's data. I have an answer on that too somewhere, lemme find it
 
I may as well put all the private stuff in a closure without symbols
 
32
A: ES6 class variable alternatives

Benjamin GruenbaumThe notes in the ES wiki for the proposal in ES6 (maximally minimal classes) note: There is (intentionally) no direct declarative way to define either prototype data properties (other than methods) class properties, or instance property Class properties and prototype data properties need...

@Mosho that's not the same thing, the reason it's in the constructor isn't because of the closure it's because it's data. Public members are in the constructor too anyway.
You can define methods with bracket notation though if you'd like - ES6 lets you do that - you just generally don't want to do that for data.
And anyway, use _ for privates anyway, it'll make your life much easier when you need to debug things.
 
11:53 AM
@JanDvorak yes it was , thanks :)
 
@BenjaminGruenbaum alrighty
 
Just make up a convention with Sahar or something :)
Also - sup? I'm coming to work tomorrow and so is Gilad, what'd I miss?
 
Gilad is in today
and not much, another week another version
looks like the rxjs search will be out this time
 
Next time it is
 
no, it will be out this time
are you going to talk at that conference?
if I can get backstage tickets you can get a bj
just saying
 
THE
11:59 AM
why everyone is blanking me out or is it D3.js ???]
 
@THE it's not loading for me :P
 
I only used D3.js once to display some logarithm grapth
 

« first day (1634 days earlier)      last day (3313 days later) »