« first day (1558 days earlier)      last day (3373 days later) » 

12:00 AM
Only if you know the code inside out
There's no way you can do that with someone else's code
 
    var STEP_DEFINITION_PATH_REGEX = '\\s*?# .*';
    var MULTILINE_WHITESPACE_REGEX = '^\\s*';
    var SERVER_LOCATION_REGEX = ' at http.*';

    function formatData (data) {
        data = data.replace(new RegExp(SERVER_LOCATION_REGEX, 'g'), '.');
        data = data.replace(new RegExp(STEP_DEFINITION_PATH_REGEX, 'g'), '...');
        data = data.replace(new RegExp(MULTILINE_WHITESPACE_REGEX, 'gm'), '');
        return data;
    }
How I'm actually using it right now
and yes I know.
 
I hope to god you never need to match a backslash
Also, it can't be efficient to re-create the regex from source every time.
 
@KendallFrey I'd argue the opposite. If I come into a file I can read and modify the constants right off the top. It's going to be a lot harder to find the specific place in the logic where the match happens, most likely.
 
@Retsam My experience with debugging doesn't work like that.
Also, what if the bug is where the regex is used?
You could waste a lot of time tinkering with a regex that's already fine.
 
12:05 AM
@Eugene It pretty much just comes down to hoisting.
With the var version, you can't use the function before it's defined.
I think convention dictates the named function version
Also, it should be named with UpperCamelCase
 
@KendallFrey I don't see the relevance of that to inlined vs. variable. I could just as easily spend hours messing with a regex that I've inlined, only to discover its not the problem.
 
hmm, this is probably a dumb question, but what is the scope of what a directive does vs what a controller does? I can't tell if adding WebGL to a page would be on the controller logic or on the directive logic
 
@Retsam If the code is all in one place, you're more likely to spot a potential problem.
 
@corvid it would probably be in a service?
 
A service? Isn't that usually for restful requests?
 
12:09 AM
@KendallFrey Ehh; this seems like a very small distinction. Again, we're in the "analysis" phase in which, sure you need to look closely at both the regex and the code that uses it. Either approach is going to be pretty much the same.
But when you're not in an "analysis" phase, the non-inlined version is far more readable. And I think the advantage of readability trumps the, I think, small penalty to debugability.
 
I disagree with readability
 
Well, then we're arguing in a circle. I think str.match(EMAIL_REGEX) is far more readable. If that's the point we can't agree on, then I guess to each their own.
 
@corvid No, not only for those
 
@KendallFrey I see. Great explanation. Thank you very much.
 
12:26 AM
bezier to bezier intersection code. clipping,subdivision, idc what kind. anyone got a javascript implementation? stackoverflow.com/questions/28057619/…
 
@phenomnomnominal I see... then I think I've been doing something quite wrong.
 
@corvid that happens
 
12:48 AM
dependency injection is odd. I am trying to structure my front end differently and think I messed up the dependencies bootstrapping :\
 
1:20 AM
Is it bad that I still smile a little bit when people say stuff like "I am trying to structure my front end differently?"
 
user1596138
1:32 AM
Penis?
 
2:08 AM
> Naturally, that isn't ambitious enough for Musk, so he's also hoping that it'll be the start of a SpaceX internet connection to Mars.
 
Hey guys, can you edit a google calendar from an external site with a AJAX or POST method? Some kind of request.
 
hey guys, i have short question... self variable this of declared class has been changed by other called function of second declared class.

var self = this;
function b(){self.functionOfClassA();}

this code works, but any other solution exists?
 
@machei 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.
 
!!tell machei mdn bind
 
2:14 AM
thank u, that's answer :D
@CapricaSix u have granted points.
 
@machei Caprica is a bot.
 
Sim
is there way can i add default videojs loader only with sublime skin? example jsfiddle.net/sf229zej
 
hrmph. Not sure what I am doing wrong here, following this book exactly.
 
have you tried turning the book off and back on again?
 
th... that fixed it
 
2:31 AM
where should i send my invoice?
 
app.use(expressSession({
  secret: "****",
  cookie: { maxAge: 60 * 60 * 1000 },
  store: new mongoStore({
    db: mongoose.connection.db,
    collection: 'sessions'
  });
}));
throw new Error('Required MongoStore option `db` missing');
              ^
Error: Required MongoStore option `db` missing
 
verify mongoose.connection.db isn't null / undefined
 
user2620028
@taco hi taco. Yeah i made it to thailand dec 31'st
 
@Luggage yep, that was the first thing I did. It gives me back a very big json which doesn't seem to imply an error
 
2:47 AM
No idea, then.
But, a javascript object is not a 'json', btw.
json is a string representation of an object. :)
 
@Luggage i know that's a typo, but i think calling them jsons would be pretty hilarious
 
Fixed :)
app.use session({
    secret: 'xxxxxxx'
    store: new MongoStore({ db: db.connection.db, expire: 60 })
})
@corvid That's code that worked for me. looks the same.
db.connection is mongoose.connection
 
what order did you import in?
 
the require's? shouldn't matter.
 
hmm... would it throw that error if the database url was pointing to the wrong location?
 
2:59 AM
I don't know that either.
i don't use mongo anymore :)
I moved ot redis
(for sessions).
 
how is it? I am just using mongo cause this book uses mongo
 
It's an in-memory db for caching, sessions, etc. It works for me.
mongo should work, though.
 
redis is pretty cool
 
Many pople here will tell you to not use mong and that it's terrible.
But that has nothing to do with you just following along with some book and settin up an ap
You mentioned the db url being wrong. Do you have mongoose working and the connection open?
Have you confirmed that?
 
Mongo is overused. It's good at a certain subset of problems.
 
3:07 AM
True, but he's just learning. It's not relevant, yet.
not choosing the tech for a big project, I assume.
 
Yeah, totally. Learn all you can while you can.
 
// get data from server
$scope.myData = {};

$scope.myData.doClick = function(date) {
var request = $http({
// ajax request
});
request.success(function(data, status, headers, config) {
$scope.myData.fromServer = data;
});
}

$scope.myData.doClick('2015-01-10');
console.log($scope.myData); // here I get all the value of "$scope.myData.fromServer"
console.log($scope.myData.fromServer); // but here show "undefined"
plz take a look
 
@SomeKittens, thanks I'm working on it
 
I think he's saying that he gets a response, it just seems to go into the wrong variable?
that's how i interpret the console.log comments
 
3:12 AM
@Luggage, you are right. i get response, why $scope.myData.fromServer is undefined
 
is your console.log being run manually in he console after the reponse? or right in your code like you pasted?
 
ok
 
@Luggage yeah I used mongo and checked that my db was listed to begin with
 
ok?
 
OK!
 
3:14 AM
lol
 
ohh neat. i just realized i can hold down vowels to get the accented versions like â or é
 
New to OSX I take it?
 
6 months+.
but relatively new considering i've been using PCs since they were called PCs
 
3:32 AM
who here wrote qbasic programs back in the day?
 
Me. Though I wouldn't call them progams.
More like fucking around
 
I did so much qbasicing ><
even made a few games
some of them even playable :P
i miss those days
 
While I understand the nostalgia, things are so much better now.
 
I remember having to choose between 640x480 at 16 colours, or 320x200 but 256 colours... or just ascii. Good times.
aight home time you guys be good yahear?
 
I refuse to let the morality of my behaviour be dictated by your demand
 
3:47 AM
wow such rebel very independence much edgy
 
!!doge rebel, independence, edgy
 
     wow
                  such rebel
                         so  independence
very  edgy
 
4:10 AM
8====>
 
@BenjaminGruenbaum I might have killed the momentum on the newer selector question already by closing it as dupe
But eh, having mentioned the older question in chat alone it was bound to be flagged sooner or later
 
Sim
5:15 AM
can you guys give me and advice which theme looks better the original from videojs.com or jsfiddle.net/sf229zej thanks
 
@rlemon Thanks man. Appreciate the prizes.
 
 
Sim
5:30 AM
@RahulDesai kaysay ho 22
 
@Sim mast
 
Sim
@RahulDesai acha hay 22
 
@Sim Whats 22? :D
 
Sim
im punjabi lol
 
Cool. I am Marathi. :)
 
Sim
5:40 AM
lol
hold up let me use google translator lol
@RahulDesai u wana help me something?
 
user3949359
What is string sanitation in Javascript?
 
5:56 AM
@Sim sure
 
Sim
im trying to add skin to videojs i have everything working except a lot of users suggested me to add duration time
@RahulDesai jsfiddle.net/sf229zej/1 i added the css for duration
 
@Sim I dont see the duration in your fiddle.
in the output
 
Sim
im trying to decode the original css and js used in videojs.com
@RahulDesai
 
Not sure about it. Never used videojs.
 
$('#Panel1').append($("<div>get</div>")); this is placed in each function and it prints 'get' 10 times in 10 new lines. How can i get it printed side by side, 5 in each line?
 
Sim
6:06 AM
@RahulDesai wht will be simples way to add duration to <video>
 
@Sim keep checking videoElement.currentTime
@Sim Take a look at my custom video player here: github.com/rahul-desai3/video_player
it doesnt have the duration, but you will get the basic idea about it.
 
Sim
i currently use videojs im just trying to upgrade the skin
i love the new skin just duration is the issue so far
 
@Sim check their docs, might help
 
7:04 AM
Mornin o/
 
Sim
@BenjaminGruenbaum nigth here
 
@Sim we use internet standard time - when you enter the room it's morning and when you leave it's night.
 
Sim
got it
morning
 
7:23 AM
lol, morning!
 
user2620028
morning
 
:o morning
 
@wishall 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.
 
Sim
how do i get more points here?
 
Hi
 
user2620028
7:33 AM
whudup darkyen
 
[jQuery] Any clue why .data("name", "newValue") is not working for me, but .attr("data-name", "newValue") is working like a charm?
 
7:51 AM
woot, first bounty :D
 
Guys, how do I get the ellipsis on the right place here? jsfiddle.net/oo2u18gy/4 As of now, its at the end of the <p>.
 
@RahulDesai First of all, this isn't really JavaScript...
Second of all, "the right place"?
You aren't new to chatting, you know what kind of details you need to bring and how clear you need to be.
Come on...
 
hi all..
i'm trying to repopulate json data into an array using JS. this is my question: http://stackoverflow.com/questions/28061937/populate-highchart-column-from-json
Hope you can help me. Thanks
 
@Mkhuda 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.
 
8:14 AM
We're hiring backend (C#) developers at TipRanks! If you're interested or have any questions send me an email at benji at tipranks.com
9
 
8:27 AM
@SecondRikudo Sorry man. I was checking if there is any CSS solution to this. By 'right place', I meant just after the text gets cut off.
 
@RahulDesai text-overflow: ellipsis
 
@SecondRikudo yess, but thats kinda complicated with multiple lines
 
@RahulDesai No, it isn't?
 
I found this: codepen.io/martinwolf/pen/qlFdp and working around it
@SecondRikudo I googled and it appears that there is no easy way of using that property for multiple lines.
 
@RahulDesai text-overflow works on the element level
As all CSS properties
You aren't clear about what you want the output to be.
Make a page/image/whatever that shows exactly what you're trying to accomplish please.
 
8:36 AM
@SecondRikudo I kinda got it working here: jsfiddle.net/8h0ondkb
need to make it compatible with non-webkit.
 
@RahulDesai this is the worst possible solution to this problem
 
@phenomnomnominal Why? :-|
 
Just add the content when you click the button.
A) as it stands you still have to load everything.
B) This is just fucking mental
So just give it one style, that works with all the text.
Then make an AJAX call when you click the button
 
How much of the text should I be loading initially? Like suppose I want to show 50%, then?
 
Then load 50%.
 
8:40 AM
I actually appreciate it because its a pure CSS based solution. After googling they threw tons of jQuery plugins at me.
I know its not perfect though.
 
@RahulDesai that is the worst reason to do anything.
 
@SecondRikudo know any C# people?
 
@BenjaminGruenbaum Yeah
But he's in a contract with the devil and won't get out for several more years.
 
@SecondRikudo send them our way - assuming they're good.
 
Question: "Why isn't my script tag working?" (stackoverflow.com/questions/28063650/…)
<script>
src="time.js"
</script>
/me facedesks... Hard.
CV'd that, @dystroy.
 
As there were a few boring answers already, I added a better one. But it should still be closed IMO
 
How would I get a name from another variable into another? Example:

var oProject = {};
oProject.test = test;

var oField = 'test';

What i want is soemthing like: oProject.[oField] - tried that way and with {} - no luck
I'm not sure it makes any sense, I'm such a bad explainer :)
 
@dystroy: Heh, I did exactly the same
 
oProject[oField]
@Jacta remove the dot ^
 
9:46 AM
aaah - ofcause!
@dystroy Thanks alot, did'nt see that :)
 
@Cerbrus isn't type="text/javascript" required?
 
@Cerbrus yeah but mine is functional :)
 
@BartekBanachewicz: nope
 
@BartekBanachewicz no
 
9:47 AM
Isn't mine?
 
<!ELEMENT SCRIPT - - %Script;          -- script statements -->
<!ATTLIST SCRIPT
  charset     %Charset;      #IMPLIED  -- char encoding of linked resource --
  type        %ContentType;  #REQUIRED -- content type of script language --
  src         %URI;          #IMPLIED  -- URI for an external script --
  defer       (defer)        #IMPLIED  -- UA may defer execution of script --
  >
 
@BartekBanachewicz
41
Q: Do HTML5 Script tag need type="javascript"?

GusDeCooL Possible Duplicate: Do you need text/javascript specified in your <script> tags? Do in HTML5, the <script> tag need attribute type="text/javascript"? I mean isn't it obvious if the <script> tag will be contains javascript?

 
oh wait that was old spec
> The default, which is used if the attribute is absent, is "text/javascript".
I wonder who signed that.
 
and all browsers always considered javascript to be the default, even before it was in the spec
 
I wonder if there was any reason other than "everyone's doing that already"
 
9:51 AM
How would you call a "someone is a real asshole" check in code comment? More friendly.
 
@BartekBanachewicz a reason for what ? For having the type in a script element ? I think that was officially required even if not necessary
 
type="bytecode/llvm"
type="bytecode/javascript"
type="text/lua"
@dystroy I don't know, the whole evolution of client-side programming was so fast...
 
-4
Q: Why won't my js file execute?

it_is_a_literatureThere are two files in the same directory,one is test.html ,the other is time.js. All the source code are here ,simple. Source code of test.html : <!DOCTYPE html> <html lang="en"> <head><titile>test it</br></title></head> <body> current time</br> <script> src="time.js" </script> </body> </html>...

 
Don't use a type attribute for JavaScript scripts. It's officially optional in HTML 5 and the only thing is does is present an opportunity for a typo to cause the script to be ignored. — Quentin 22 mins ago
lol FFS\
it's "officially optional"
 
well, yes, as in "it was optional before but not according to the spec"
 
9:56 AM
my point is that "don't use it, it's optional" is as valid as "use it, it's optional"
 
As in, older browsers use text/js as a default, right?
 
@Cerbrus yes. All of them.
 
So no point in adding it
No point whatsoever
 
no point in removing it either
 
Less data
Less possibility for typo's
Cleaner code
3-0
 
9:57 AM
I think the fact it was made optional was a mistake by W3C
 
Because?
When was the last time you used anything but JS in a script tag?
 
or rather, not a mistake, but <conspiracy-alert> someone had some input on that
@Cerbrus I used ES6 in marked tags because traceur used those. Anyway, when was the last time I was given a choice, eh?
 
Should we still point in all our answers all the things that aren't compatible with IE8 ? Or can we go on and forget that infamous past ?
 
I still do, @dystroy.
 
@Cerbrus the last scripts I added in Miaou aren't JS
 
9:59 AM
@dystroy Assume newest by default, duh.
only add clarification (perhaps in comments) if OP specifically asks for it
I don't ever tailor my code for C++03 for example. If someone explicitely requires old code, I shrug and move on.
 
This is JS we're talking about
 
A lot of people are still on Windows XP
So, on IE 8
 
A lot of people still use C++03. I just stated my opinion on how those cases should be handled.
 
If you're using functions that aren't available in IE8, in your answer, the least you could do is mention the compatibility issues.
 
10:01 AM
And my moral code states that providing an answer that works on latest version/revision only is perfectly fine
@Cerbrus But you're not listing compatibility issues with every possible browser/version out there. In a few years, those notes will become obsolete.
 
Then I don't like your moral code. Say, IE 20 comes out with some new JS feature... Sure, write your answers for IE 20 only.
 
IE-only would be a bit biased.
but if all new browsers adopt it, why not?
 
@Mkhuda HI
 
Only mention it for browsers that have a significant market share.
 
market share changes.
 
10:03 AM
Which, at the moment, basically means "IE8"
 
SO answers aren't supposed to be valid only for a year or two
 
So, instead, you just ignore older browsers
 
If I were actively writing in that tag, yes, I would
if someone wants to add an alternative legacy-based answer, sure, go ahead
 
How is not mentioning compatibility with commonly used old browsers a good thing? seriously
Oh, I see you don't even answer in JS...
 
document.getElementById("start").id = count;
 
10:07 AM
@Cerbrus I just don't feel that JS deserves any special treatment.
 
still trying to figure the goal...
 
This is not special treatment
This is day-to-day work for a front end developer
 
Hi @kuldarim
 
@Cerbrus The fact the compatibility issues arise is IMHO partially because developers agree to put up with that crap
 
...
I'm done discussing this
Sure, blame the devs for IE compatibility issues.
 
10:09 AM
Of course it's easy to blame someone else
 
@BartekBanachewicz I feel like most people give up quickly when arguing with you :(
 
Maybe because it's frustrating to do so.
In my experience, at least
 
@FlorianMargaine I'm not sure it's because I'm a dick or because I say things they don't want to hear, or both.
 
@BartekBanachewicz I'd say a mix of both
more of the 2nd tho
 
10:11 AM
@Bartek, what don't I want to hear?
Now I'm curious
 
!!summon 43899
 
what it is?
 
Apparently there's nothing I don't want to hear
 
Good day.
 
@Cerbrus I think that if developers had more firm attitude towards legacy support, the browser manufacturers could put more pressure on the users for the updates. I understand that in some cases an update isn't possible, but in that case I still believe it's in best interest of every party to try and find a solution.
In reality though, browser manufacturers do whatever they want, users refuse to update and it's developers that are giving up and writing shims, hacks, and workarounds.
@Cerbrus I was trying to word it in a less Bartek-ish way
 
10:16 AM
@Cerbrus don't be a dick
@BartekBanachewicz users don't care though
 
Bartek, I get what you're getting at
 
It's just that I think WWW is a great thing and we're kinda responsible for it.
 
But realistically, there's nothing devs can do to speed up phasing out legacy software
Users refuse to update. We can tell them to, sure...
But in the end, they have to buy a new OS
 
I dunno, if Google stopped working in IE8 I think it'd happen pretty quick
 
Google doesn't support IE8
 
10:18 AM
does Chrome support windows XP though?
 
Sure
 
Well in that case it's easy for google. Stuck on XP? install chrome.
 
But they can't just not support an OS like that
Ehm
Then you're helping people stick with XP
 
I don't think that's what you want to do
 
10:19 AM
@phenomnomnominal GMail doesn't even support IE9 anymore. And it's official
 
Seems to
 
@dystroy for the record, the spelling is "Gmail". I checked recently :P
(I used to write it "GMail" too, a week ago)
 
@phenomnomnominal: An article from 2013...
 
Guys, quick Q. If one has an array of objects, where each object has a method with same name, then how could one reference this object properties or other methods inside this method? gist.github.com/jeserkin/3cfbae5aae6505d11186
 
@Cerbrus saying they'll support through to 2015?
 
10:20 AM
Things change
Especially when software is concerned
 
Isn't your current argument that things don't change fast enough :P
 
Users don't change fast enough
 
@Eugene You must use the data variable or build your object in two steps (you may use a factory for that)
 
Software changes, users can't keep up
 
There's no this for a literal (I mean it's not the literal)
 
10:21 AM
@Cerbrus well in that case I wonder (going a bit back to beginning of our discussion) whether it's better to explicitely state lack of compatibility (which might prompt oh so could you add an IE8 equiv.) or simply let the devs who try to run the code on IE8 experience the spectacular failure.
 
Fair point
 
@Eugene - I don't get it -> jsfiddle.net/0mmod19o
2
 
But usually, you'll end up implementing the polyfill any way, 'cause management want maximun compatibility
 
We have even more complex compatibility issues at work :S but the management understands it's sometimes not worth it to allocate us to fighting with this one particular phone from 2008
 
You could mention compatibility, with something like "If you have to support old browsers, you could use <polyfill>"
 
10:23 AM
@dystroy okay. Could you make an example? Not sure I understand it all. I should work with data[...] inside method to achieve functionality?
 
@Cerbrus Depends. If the modern features of browser bring enough added value to your application you may market it as dependent of those features. That's what I do. But of course I don' do sites, but applications.
 
Phones get replaced more frequently, afaik
 
than browsers?
 
Than desktops
Or their OS
 
well it's still the case of software we're talking about. You can't make your phone compatible with ES3 by downloading a new OS in most cases
 
10:25 AM
Are there phones out there that can run JS but don't support ES3?
 
@dystroy I ignore IE8 for the past year
 
@Cerbrus Or (I know this is a crazy idea, and I am not sure whether I like it but) you could leave it out, force the developer to write the shim himself if management requires it, and then mayhaps they'll see that the cost of legacy support is too big and allocate more forces to convince users to update.
@Cerbrus oh of course
ES3 requires fairly advanced hardware support
it's not just about writing new drivers or something like that
 
Hm, TIL :-)
 
for example, it's mandatory for an ES3-compatible device to be able to decode compressed textures on hardware
 
So, basically, let the devs feel the burn of having to support legacy software
 
10:27 AM
my point is that in the end everyone feels that burn.
for the cost of a few more dollars squeezed out right now. But I don't see exact figures, so I might be wrong
might be that it's still cheaper to hire 10 interns to write IE8 shims than to abandon it
 
Everyone but Microsoft, it seems
 
IE8 isn't that expensive to develop for from a JS perspective, it's the CSS that's horrible on it.
 
Ugh
 
IE8 has a JIT and shimming most of ES5 is pretty easy.
 
Tell me about it -.-
Yea, most JS functions have polyfills on their MDN pages
 
10:29 AM
It's also hard to debug, annoying and crashes a lot.
 
and also no svg or canvas
 
hm that reminds me
I was supposed to look at Facebook's RAM profile
11MB of "compiled code"
I wonder how accurate that is
 
10:51 AM
in PHP, 27 mins ago, by DaveRandom
PCRE has \R as shorthand for \r\n|\r|\n
pretty cool
 
@BartekBanachewicz: That 11MB, is that only slient-side files?
(Scripts / html / css...)
 
Huh, promisify doesn't work on require('npm')
 
@Cerbrus the whole page shows 69.7MB of usage
 
It's easy to get your own; open the page, open dev tools, profiling, second option
 
10:53 AM
it seems that except for bindings, there's no pure js pcre implementation
 
Memory usage can be larger than code size :P
 
@Cerbrus There's a lot of things. And minified names. That 11MB seems to me like JITted binary cache
 
Hm, can't really open FB at work
 
omg omg omg I love emacs
@Zirak M-1 M-! ls /some/folder/
 
@Cerbrus byte [11]; is bigger by exactly one byte :P
@Cerbrus BUT RESEARCH :)
 
10:57 AM
Good Evening brothers and sisters
 

« first day (1558 days earlier)      last day (3373 days later) »