« first day (1647 days earlier)      last day (3316 days later) » 

9:05 AM
Anyway, jQuery has won. Last I heard, 80% of sites that use a JS framework use jQ.
 
so? doesn't mean the source code is great
 
Which code-base are we talking about, though? 1.x or 2.x?
 
Well.. Bootstrap requires jQuery. There will be quite a few inheriting from that.
 
@RoelvanUden Only if you use their JS
 
All my angular projects also have jQuery included because of that sillyness.
 
9:08 AM
@FlorianMargaine Perhaps, but is means little to most people. I mostly read 1.x, because when I can use 2.x I don't really need it.
 
@ivarni Things like the popping menus etc, require it :-(
 
@RoelvanUden Are there really that many sites using bootstrap, though? I always thought of it more as a prototyping framework
 
@RoelvanUden Not really, but you have to implement the logic in your own directives if you don't use their JS, the CSS is all there
Usually it's pretty easy, and then there's projects like AngularUI that also give you bootstrap directives
granted, I don't think they cover every single thing, but again it's not that hard to make custom directives for what's missing
 
That's actually pretty cool. Thanks for sharing :3
 
I feel that jQ is becoming like early Spring/Hibernate. You must use it because everyone else use it. But unlike SSH, our core language is not going to offer any alternatives...
 
9:12 AM
You can use whatever you want, jQ is by no means necessary or non-replaceable.
 
I think that unless you're needing to support a range of older browsers, jQ doesn't really offer that much, I guess more than half the jQ usage out there (plugins excluded) could be replaced by the Selector API
 
I'd appreciate some clarification on captured variables in anonymous functions:
 
For a small project. When you start using many 3rd parties, I think it is easier to roll with it. Less mental switch.
 
I have a loop running over some elements, and for each one, I'm adding a new function to an array, destructors, with anonymous functions to destroy those elements at a future date.
But I want to make sure I capture the elements in the loop properly.
 
@Sheepy If you don't like to think about what you're doing, why did you go for software dev? :p
 
9:14 AM
645
Q: JavaScript closure inside loops – simple practical example

nickfClosures are one of those things that have been discussed a lot on SO, but this situation pops up a lot for me and I'm always left scratching my head. var funcs = {}; for (var i = 0; i < 3; i++) { // let's create 3 functions funcs[i] = function() { // and store them in fu...

 
@RoelvanUden I like to think, but I'd rather spend the juice on logic and structure, rather than shifting mental model.
 
@JanDvorak Ok, so instead of just doing destructors.push(function() { kill(myElement);});, I should do function { var capture = myElement; destructors.push(function() { kill(capture);})}();
?
(Might have gotten some parentheses mixed up there)
 
looks good
 
@AvnerShahar-Kashtan Yes. You are learning fast!
 
I'm used to closures and captures in C#, I'm just trying not to trip up on JS's... idiosyncracies.
Thanks for the help!
 
9:18 AM
@AvnerShahar-Kashtan Hey they are unique features! :D
 
Hello guys. I'm trying to find the top offset of my element as if it was positioned absolute. The value I'm currently retrieving using getBoundingClientRect() is dependend on my scroll position but I want an offset top from the start of the document. Basically it shouldn't move I was to the value I'm looking for as "top" in css.
 
@Sheepy And that adds personality to a language ;)
 
@AvnerShahar-Kashtan If you can use ES6 let you can make it like C#:
for (let i = 0; i < 10; i++) {
  let yay = i;
  setTimeout(() => console.log(yay), 100);
}
Yay.
 
@RoelvanUden Can't really get away with ES6 quite yet, I'm afraid.
 
@AvnerShahar-Kashtan you can use a transpiler
 
9:21 AM
I'll settle, at this point, for untangling the spaghetti mess of this current app I've inherited.
 
setTimeout( () -> { console.log(yay); }, 100); // Don't forget fat arrows.
 
Fixed :)
 
*sigh*. Lambdas.
 
Now we can further simplify it with array comprehension ;)
 
I'm using underscore.js, but it's still not quite the same as LINQ.
 
9:23 AM
I love lambdas
 
I miss lambdas. My previous project was Java 7, where their lack was even more painful.
 
@AvnerShahar-Kashtan With ES6 lambdas it gets pretty close though. Especially if you layer TypeScript on it :D
 
@JanDvorak I'm not that well traversed in FP so I never really grasped what lambdas give me that anonymous functions didn't already provide, except less typing
 
Java lambda is nice, but limited like generic. JS lambda is much better...
 
@Sheepy Java 7 doesn't have lambdas at all, and no anonymous functions either, just big, clunky, anonymous types
 
9:25 AM
@ivarni it's the syntax, most importantly
 
@AvnerShahar-Kashtan Me and a friend did a tree-traversal in Java6 using only anonymous types for a kata, the resulting source code looked hilarious
 
@ivarni In theory, we can write any program only with conditional jump, too.
 
@Sheepy Granted :)
 
You can do with one instruction: subtract A from B and jump to C if the result is nonpositive
 
I wonder if making an esoteric language that uses "comefrom" rather than "goto" would be fun
 
9:28 AM
@ivarni look up INTERCAL
 
I am quite sure someone has already written a language for this idea XD
 
@JanDvorak Oh, they have it already, well damn there goes my 15 minutes
 
is it worth it to pay an extra £200 for the 256 ssd instead of the 128gb mac one?
 
It's not worth paying for anything Apple.
(Let the flaming commence)
 
@SuperUberDuper As the primary HDD? 128 isn't nearly enough.
 
9:32 AM
Concur. (Put oil to the fire)
 
shucks
 
I'm on a 256GB SDD and just barely scratching it
 
antiApple++
 
after using a mac for 6 months I cant use a pc
 
(Mostly because my Dropbox is sync'ed to it)
 
9:33 AM
looks like my business account is going to lose £1120 today :~~~~~~~(
 
In fact, I'm considering putting a second HDD in mine, though I'm a bit leery of gutting it.
 
@SuperUberDuper Ask me. I have been using trackballs for five years. Two days ago I had to use a mouse. I didn't know using mouse can be so dreadful. (Starts a new fire)
 
I need to make sure I get a new contract to cover those £2500 VAt payments
 
@Sheepy wat
 
@Sheepy I'd rather use a racing game steering wheel than a trackball...
 
9:35 AM
@Sheepy can you even buy an external trackball?
 
@JanDvorak It's getting harder and harder now. Even online store often tells me out of stock ~>_<~
And it is even harder because I use it with left hand.
 
\o/
 
never used a trackball
is that nice?
 
Kinesis, whose ergonomic keyboard I use, sells trackballs
ordering shouldn't be an issue
 
@Mosho lol, sorry, it's still funny.
 
9:39 AM
eat me
:P
 
I don't eat doges, soz.
Are you coming btw?
 
idk
 
I think so. My hand used to hurt from too much programming. Then I switched to trackball and Colemak keyboard layout. Now they don't hurt (that much).
 
maybe
will it be good?
 
I don't know, honest, I'm going
 
9:40 AM
they also sell this:
 
@Sheepy try Dvorak
 
it looks very satisfying to hold
 
@JanDvorak Tried. I am sticking with Colemak.
 
@Mosho TWSS
@Sheepy why?
 
@JanDvorak Easier to learn, easier to type, compared with Dvorak. One week to get comfortable, one more to accurately touch type.
 
9:42 AM
@BenjaminGruenbaum sahar can't come
 
user2985029
@Mosho i know someone that uses one of those
 
@Mosho Ben is coming
 
And Ctrl+Z,X,C,V doesn't change!
 
lol ... dat device
 
Also, @SecondRikudo is trying to come
 
9:43 AM
looks like a scary world domination device
 
@Sheepy I can touch-type just fine with Dvorak. Is it worth to relearn?
 
@JanDvorak Well, if you already touch type Dvorak I'd say no, not worth the little improvement.
 
@BenjaminGruenbaum I'm sure you and ben can make him come
 
posted on April 20, 2015 by heathermahan

The DevTools Timeline panel has always been the best first stop on the path to performance optimization. This centralized overview of your app’s activity helps you analyze where time is spent on loading, scripting, rendering, and painting. Recently, we’ve upgraded the Timeline with more instrumentation so that you can see a more in-depth view of your app’s performance. We’ve added the follow

2
 
@Mosho Great!! simply great
 
9:47 AM
and does all things!
 
(Silently cry for my beloved Firefox)
 
10:04 AM
Has anyone ever worked with the spectrum.js color-picker library?
 
10:19 AM
Just noticed my chrome dev console doing syntax highlighting. When did that sneak in?
 
\o/
 
@BenFortune ooh nice, that must have been recent
 
not while typing, though
 
Yeah it's the latest update im guessing
 
Didn't notice it on thursday while playing around with that script that changed fonts every 10 sec
 
10:21 AM
I havent updated yet and I don't have syntax highlighting
 
@Feeds Must be the update that gave us this
 
> Version 42.0.2311.90 m
 
That's what I have
 
41.0.2272.118 m
 
10:22 AM
It only highlights on eval though
 
I'm soon tempted to revisit the idea of developing directly in the devtools and map it to workspace
just have to find a way to make that work with browserify...
 
@ivarni Isn't that what Firefox Dev edition tried to do?
 
@BenFortune Dunno, I haven't used FF for ages
 
Recently moved from Sublime to Atom
 
The idea is pretty cool though, especially when debugging, you can save the file, drop up a frame in the callstack, re-run see that it works and have it already written to disk
 
10:26 AM
Can you force chrome's console into strict mode?
 
forever?
 
Just in the current session
 
You can try
 
@ivarni I tried that but in the end it's not a good enough text editor for me
 
Or even forever, as long as I can turn it off.
 
10:27 AM
@Catgocat I have my first book for a month now "JavaScript & jQuery" John Duckett ;)
 
@Mosho It does have stuff like multiple cursors but for someone like me who uses Ctrl+W to close a file while editing it comes with some... unwanted side-effects.
 
Heh, using let in FF dev console works fine.
 
@RoelvanUden for like... 5 years. Firefox implemented let for ES4
ES4 never ended up being adopted and was skipped - it used to have incorrect semantics, maybe still does
 
Hmm, maybe. What incorrect semantics would it have?
 
10:37 AM
Is a block scope defined via curly brackets? For instance, the following doesn't work.
let x = true;
if(x) let y = false;
> SyntaxError: let declaration not directly within block
 
yo, anyone use soundcloud here and mind testing my new app please? (Still in beta) mixmatic.io
 
Actually just realised how stupid that question was. Leaving it for the derpz.
 
@PhilHudson why did you people flag that?
As in - who flagged that?
 
@BenjaminGruenbaum I wanted to see if it was multiposted before I counterflag that
 
@BenjaminGruenbaum flag what?
 
10:42 AM
maybe considered spam?
 
@PhilHudson don't worry about it
 
or over self-promotion?
 
i just wanted to see if anyone could help test before release
if not i will remove it..
it's fine :)
 
@PhilHudson This is allowed here though, don't worry.
 
but it seems this room is OK with that...
 
10:43 AM
I asked who flagged it in order to help them understand the etiquette here better.
 
@BenjaminGruenbaum Sorry, that was me. Wasn't aware that it was allowed.
I'll read the rules again.
 
ah thanks man
 
That's fine, no harm done
 
@BenjaminGruenbaum I can't see anything explicitly allowing it, maybe something to consider adding to the etiquette?
Since it's outside the scope of SO, but allowed in the chat.
 
It works the other way around - anything not explicitly disallowed is usually around
 
10:47 AM
Ah, the grown-up approach to moderation, I approve of blacklists in that instance
 
The only real rules here are "don't be a dick" and "don't ask to ask - ask"
 
Noted. :)
 
Any crossposting shall be punished with the greatest ire, however.
 
i have a urgent problem, my logic tells me that this should wotk, but it does not,
`var historyComponent = {
dateWidth : 150,
detailsWidth : 300,
animationTime : 400, // ms
init:function(){

this.slide();
},

slide:function(){
$('.details').css('left','-'+this.detailsWidth+'px');

$('.dates').hover(function(){
$(this).next().animate({"left":this.dateWidth},{duration:this.animationTime});
});
}
}`
lol really?
where? the js does not say a thing in the console
 
Formatting please
backticks don't work in multiline posts
 
10:55 AM
how ? i tryed when i pasted this, i used code as in the faq said
 
CTRL+K
 
'code'*
oh cool
 
nice
 
highlight it first
 
var historyComponent = {
    dateWidth : 150,
    detailsWidth : 300,
    animationTime : 400, // ms
    init:function(){

        this.slide();
    },

    slide:function(){
        $('.details').css('left','-'+this.detailsWidth+'px');

        $('.dates').hover(function(){
            $(this).next().animate({"left":this.dateWidth},{duration:this.animationTime});
        });
    }
}
 
10:57 AM
How's it used?
 
this is pointing to the wrong scope in your hover callback function.
 
historyComponent.init(); on document ready
i did a console.log() on each of the variables
they seem to have the value
 
not inside the hover callback
 
omg
u are right
hmm and how do i acces them in the hover?
 
$('.dates').hover(function() {
    ...
}.bind(this));
 
10:59 AM
var _this = this
or that^
 
posted on April 20, 2015

After last week’s rant about, among other things, the W3C Device Adaptation spec, one of the spec’s authors asked me to clarify my critique. Fair enough. Here’s my take on the current specification. My critique of Device Adaptation consists of three main themes: The spec does not address the actual current situation at all, while all browsers actually support my theory o

 
by bind(this) i like it will inherit all the vars?
is like*
 
No. It will set this
making its properties visible where you expect
 
oh then the this will work like it does outside of the hover
 
yes
 
11:01 AM
i see
ty for the help
 
somebody used google play game services?
where does it add web application after authoirization from user?
In Chrome web store? In Google play? :D
 
THE
11:29 AM
anyone aware of a well written JS program code I could look at to learn ?
 
Well.. there are plenty?
 
@RoelvanUden But easy to read for a newbie ?
 
Is any real library easy to read for a newbie?
 
@THE What do you expect to learn ? Advanced JS coding ? Style ? Java style enterprise code ?
 
THE
11:33 AM
@dystroy Have been working C# for last 4 year, so should be fine, just name it, I want to see how they architect a JS built application
 
@Vlad written by a noob, right ? In any case I really wouldn't call that good practice, and certailny not typical
 
read Doug Crockford "JavaScript the Good parts" and Stoyan Stefanov "JavaScript Patterns" and there you have it
no
 
THE
@Vlad I already seen his videos and read his book, i learn by examples
 
@THE I know mine, which is OK. Most other open codes that come to my mind are libraries, not applications, and are thus a little harder to read
 
THE
which is why reading and watching is not that helpful really
 
11:35 AM
make a HTML5 game with Phaser
 
THE
@dystroy mine library or app ? spacebullet you referring ?
 
@THE This is a bit shameless self advertizing, but you might find github.com/Deathspike/mangarack.js interesting. It's a NodeJS CLI application adapted from an existing C# code base (github.com/Deathspike/mangarack.cs). Not sure if that's what you're after though.
 
@THE Spacebullet is simple enough so you could grab some ideas. Miaou is bigger and probably more interesting
 
Damn this google app services is so complex :D
I cannot connect a single app for scores
 
@RoelvanUden don't worry for the "shameless", I also found that the applications coming most easily to mind were mines...
 
11:36 AM
Somebody used Google Play Game Services?
 
THE
thanks gonna have a look @dystroy @RoelvanUden
 
Trying you hand at a game with Phaser sounds like a lot of fun too.
 
@THE I've just had alook at some of the JS files linked by Roel, they look OK too
Miaou is probably too big for a quick look, SpaceBullet would indeed be clearer
 
so what happens when I authorize web app to access my G+ user data?
 
@RoelvanUden Phaser was pretty easy to use, despite horrible docs
 
11:40 AM
does that add that app in Chrome web store or Google play account?
 
@ivarni Phaser is (AFAIK) the only HTML5 game engine capable of tiled maps and with TypeScript declarations. I'm looking forward to trying my hand at a little game with it. :-)
 
I made a game with Phaser 2. The docs are ok. You can use them offline
My recomendation for Phaser is learn it by your self. Otherwise there are books kind of costly :D
30 $ for a tool that will change again in a year or so.
And was it 130$ for the code examples :D
 
I did a tile-based little mockup with MelonJS once. Is Phaser similar?
 
@Vlad But there's tons here: phaser.io/examples
 
I don't know. Never used MelonJS. Phaser keeps code like FSM in states. So yeah visuals and game logic can get mixed, but if you do often code maintenance, it can be handled well
 
11:46 AM
If I hear someone else tell me I should use Haskell instead of JS because comparisons in JS are quirky I'm punching them. Somehow NaN < 15 is bad but Just -1 > Nothing is fine. fml.
 
Yes it requires a bit advanced level of JS knowledge
 
@BenjaminGruenbaum Just don't use comparisons on Maybe
 
closures, what is "this" in current context etc... So yes it willbe a good practice for newbies in JavaScript
 
Number.MAX_VALUE > Infinity is also somewhat advanced
 
@JanDvorak just don't use comparisons on NaN
That's the same thing
I'm not mad at Haskell, I'm mad at people selling me Haskell without knowing Haskell and giving me that example as where JS goes wrong
 
11:48 AM
@BenjaminGruenbaum except you don't have a type-safe way to avoid NaNs in javascript
 
if(!Number.isNaN(x)){
    // access x in a type safe manner
}
-_-
 
I agree that maybe Maybe shouldn't implement Ord, but is it really that big of a sin?
 
It's OK it's a design flaw in Haskell, it has lots of design flaws like all other languages.
 
Another example?
 
It's just that people love dissing JS and selling me alternatives where the alternatives have the same problem.
 
11:50 AM
who cares about Haskell anyways :P
 
Oh, it's not an example, it's something someone literally told me today.
Well, it's an example but it's not made up.
Or are you asking about stuff that sucks in Haskell? Because that's not a fair game most people who know a language X can point out 10 flaws in X given a few minutes.
 
@BenjaminGruenbaum JS sucks, use LOLCODE.
 
@BenFortune LOLCODE sucks, use JS
And now recurse.
 
I still love Haskell (and javascript)
 
11:55 AM
hi, is there any way to apply a function to the 1st element of an array in lodash?
just curious if var firstElement = _.first(a); if (firstElement !== undefined) { ... } can be simplified
 
@JanDvorak I love Haskell too, I was complaining about people.
 
@meze First of all, the first element in the array is a[0].
 
@meze haha, lol
 
So lodash is pretty unnecessary for this case.
 
a.slice(0, 1).map(fn)[0]
Monads ftw
 
11:59 AM
Also, a is an array of what?
 

« first day (1647 days earlier)      last day (3316 days later) »