« first day (1332 days earlier)      last day (3619 days later) » 

12:02 AM
@phenom yup
Too bad its Monday there.
 
@phenomnomnominal not here?
 
12:21 AM
What's worse, creating a semi-global variable and instantiating it each time in a beforeEach or having the same code snippet at the top of each test?
 
The latter
But none of the two options will make you go to programmer's hell
 
12:43 AM
@SomeKittensUx2666 Here but at work :(
@SomeKittensUx2666 WET
Has anyone here used the meta tag for iOS smart banners?
 
1:11 AM
@ShamailaTahir 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:37 AM
@AllTheThingsICanDo 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:52 AM
!!urban wet
 
@SomeKittensUx2666 [wet](http://wet.urbanup.com/634944) 1)when a girl is horny and leak vaginal fluid
2)when someone has a bedwetting accident
2)to smoke PCP
@Zim 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.
 
Thank the JavaScript gods it's a public holiday here today
 
Crockford declares holidays now?
 
I think this one was declared by Nicholas C. Zakas
It's Toothless (proper noun)
 
2:11 AM
Expected { active : false, player1 : {  }, player2 : {  } } to be { active : false, player1 : {  }, player2 : {  } }
 
What?
 
error my tests threw
 
Looks like same not equal to same :S
 
2:30 AM
@HermanJunge 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.
@HakimHauston 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.
 
2:48 AM
Well.. I rode rollar coasters for the first time today
 
Oh, nice
Aren't they fun?
 
@monners to an extent. There's like.. a bit of a height limit for me, so some are simply off limits. But on all the rollar coasters I rode, only 1 really made like "holy shit i might die"
 
Yeah, that's how I was on Titan at Six Flags over Dallas
Great fun though.
 
Oh god.. and then there was the first ride. The berserker.. not a roller coaster but a friggin giant ship that swings like a pendulum and goes around a couple times... I literally passed out because ... go figure.. I don't like hanging upside down.
 
pussy
 
2:55 AM
Like I was screaming and my brother was laughing, and he just said i went limp
But I did make everybody on every other ride laugh
 
You win 5 fail points
Kudos for going on it if you really were that terrified
 
Like, at the last one, it was an indoor paranormal themed one that just takes off from the get go, and I didn't expect that, so i was in line and saw it launch and before I even realized I was freaking out I verbatum said (loudly) "WHAT?! OH HELL NO FUCK THIS NO WAY IN HELL" and of course it was dead quiet after the car took off...
 
heh
It's people like you that make those rides worth watching :P
 
People got a laugh out of that. But yes I was absolutely terrified for the ship one. White knuckling the railing with shakin hands.. great way to start the day post hangover
 
Rollercoasters hung over? No thanks
 
2:59 AM
Dude Im a riot on those rides. Anybody near me just laughed. Always at the end cause they stop so hard it litterally squishes your balls, and hurts like some shit (at least if you're 6'3), and its very funny for people to hear "oh god not the balls again!" at the end of a ride
Wild weekend man.. been a while since I've had this kind of fun
 
!!google battlestar rollercoaster singapore
 
Best Rollercoaster Ever.
 
it's closed
 
@DineshBabu 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.
 
3:08 AM
@SomeKittensUx2666 Wasn't when I went there
 
3:26 AM
@Ljubisa 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.
 
Hello
 
I got a question: I am trying to figure out how to remove padding / margin of the 3rd list element.. I am using jQuery and I tried .css("padding","0") however that didn't work. I also tried .addClass() on LOAD however no change as well any suggestions?
 
3:53 AM
need teh codes!
 
4:05 AM
similar as above described.. working on it: if(winSize > 600){
var menuItems = $('.app_slide');
var i = 0;
menuItems.each(function(){
if(i < 3){
if(i == 3){
//$(this).addClass('right');
}
else if(i == 2){
//$(this).addClass('center');
}
}else{
$(this).addClass('hide');
}
i++;
});
}
in this one I am trying to align element 2 (center) and 3(far right)
however no luck as well
 
The good news is that according to the latest IPCC report, if we enact aggressive emissions limits now, we could hold the warming to 2°C. That's only HALF an ice age unit, which is probably no big deal.
3
 
4:24 AM
@Walid 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.
 
4:39 AM
@Coleman 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.
 
@BenjaminGruenbaum you alive?
 
nope zirak ate him last night
 
4:57 AM
@TechNet-Weblineindia 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.
 
5:32 AM
@Alhadis 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.
 
6:15 AM
@t1wc o/
why is your website still ugly as shit :(
 
6:28 AM
@Mosho /o
@Mosho because I didn't change it
I'm waiting for enlightment for a new design
I'm sure it will come
 
@Mosho how old are you?
 
0
Q: AngularJS - View not rendering promise returned from GET query

owlyfoolnew to using resource and hit a roadblock. I am trying to retrieve a single 'Article' from my api by ID. This seems to work ok as i trace out the response object from $scope using console.log, but it's not appearing on the template..driving me mad trying to figure out what is causing it, any hel...

 
6:44 AM
Oh, 26, nevermind.
 
7:00 AM
@t1wc Start going to the toilet with pen and paper
That's where inspiration strikes you, and it vanishes the moment you flush.
 
@SecondRikudo strangely enough it doesn't for me...
 
Don't lose faith
I will come :D
 
I know you all would like to know that I have a problem and my shit is much bigger in diameter than average, so I really have to concentrate while in the toilet
the most inspirational moment for me is before going to bed or after a very long run (very long=marathon-like) or a very long biking trip (about 60km)
 
@t1wc you're just begging to be remembered
!!tell t1wc slidepoop
 
@SecondRikudo I've seen in 100 times
 
7:04 AM
Caprica's down?
 
!!are you alive?
 
Looks like it, I don't see her in the user list
 
7:29 AM
She's like 6th in the list, man.
Well, that's just like your opinion, man...
 
the last GoT episode was quite boring...
 
im shattered and its only the bgining of the day
 
> Well, that's just like your opinion, man...
 
@Neil as your opinion about my opinion
 
@t1wc No, actually that was fact. It is your opinion.
 
7:33 AM
@Neil then you can call mine a fact too
 
@BadgerGirl 26 physically
why?
and you must be kidding about GoT
 
!!summon 43899
 
no caprica?! you have just ruined my day!
 
7:49 AM
@Mosho I've never liked the wildling's part of the story
 
but it was epic
probably more fighting than the rest of the show combined
 
@Mosho that's why I didn't like it
at least make it 30mins and not 50!
 
you are one weird 14 year old
 
@Mosho +1
 
I'd have liked to know more about the king's landing story
and what would've happened to ser barristan
also, where was maester aemonius (or smth like that) during the fight?
 
7:52 AM
aemon
I was wondering myself
 
yeah, right
 
hoped he would turn into a dragon or something
 
in this episode there was no turn of events
didn't leave any suspence
 
so what
 
we already knew they would come, that the crows weren't expecting them
that many would have died
we've already seen giants and mammuths
 
7:54 AM
suspense is the cheapest way to get people to watch stuff
I don't like it
 
we've already seen jon use his sword
@Mosho but sometimes it's enjoyable
 
not for me
stuff rarely lives up to the last ep's ending
 
even tho this episode has left none, I'm still going to watch the next
 
I never really liked every ep going over 34278 storylines
but I guess there's no other option
this one was refreshing
 
@Mosho I think that 2 storylines par episode is the best
 
8:07 AM
I'd say they left a bit of suspense with Tyrion's storyline
He's always been my favorite character.. seriously hope they don't kill him off
 
@Neil what are you going to do if he dies?
 
@t1wc Stop watching. No, that's a joke, I'll keep watching of course
I don't hold any expectations about whether or not he'll die
 
@Neil how about a memorial?
 
I've learned better after the red wedding
 
dunno... somthing creative
well, he will die
 
8:13 AM
I enjoyed watching catelyn die
 
@t1wc Good idea. I'll play diablo 3 for a couple hours in his honor if he dies
 
@Neil probably the best thing to do
 
@t1wc I'm sure he'd approve
@Mosho I was surprised, but I didn't particularly mind seeing those characters die
 
@Mosho I remember in the first season, when rob stark was the main character
 
Funny that during that episode when they were all celebrating the marriage that I thought, "If this were real life, they'd all get ambushed for doing something like that"
 
8:14 AM
now who even cares about him?
 
My diablo 3 character is named Reek :)
 
@Neil lol
actually, for me the best storyline was the one with arya and the hound
expected to see in this episode what would have happened to them
but nope
 
8:38 AM
hey guys, i'm new around here..anyone know something on Memoization in Javascript?
 
not I, but whats up?
 
uhh..that link goes to google
@Mosho
 
!!joke
caprica :(
 
i have already googled memoization and i can't get how exactly it stores..
but gotta admit, you trolled me..
 
8:49 AM
what specifically don't you understand
 
the part where it stores the values in either an array or an object.
and unfortunately, i've been blocked from asking questions..
 
what about storing values is unclear
can you give an example?
that's me
 
@mosho my.safaribooksonline.com/book/programming/javascript/…, the part where he type checks for number
if( typeof memo[n] !== 'number' ), what if one is storing dom elements
and the last part where he makes a Memoizer function..
 
then you would have to change it to fit your use case
the memoizing function gets a function to memoize as an argument and returns a function with the same functionality but with memoization
 
a memoizing function is the perfect example to understand closures
but if you don't understand closures, it's pretty hard to "get it"
 
8:57 AM
i do get closures @FlorianMargaine
 
do you understand recursion?
 
yeah..a function that calls itself
 
what about his memoizer don't you get then?
 
type checking, in John Resig's - Secrets of Javascript Ninja, he doesn't use type checking
 
9:16 AM
he just checks if the value is in the memo
you can do if (key in memo) or memo.hasOwnProperty(key) or whatever you want
 
@SomeKittensUx2666 yup
 
@Hawk maybe a simple example like this would help you? jsfiddle.net/89wZy/2
 
@Mosho How can you take a recursive function which calls itself and convert it into a memoized function?
The recursive function calls itself, and you can't internally modify how the function works, so you can't make it call a different function
Though I think it is possible without having to manipulate the original function
 
9:39 AM
@Neil not sure what you mean. In that specific implementation it makes sense to use recursion.
because formula is recursive
it returns a function that calls the formula, that calls the recursive function that calls the formula etc.
 
@Mosho If you make the classic recursion function fibonacci, inside, it calls itself
 
yeah
 
In order to memoize, you'd need to have it call another function which tests if it's already seen that input, and if so, returns the output
 
and that's what it does there
 
But you can't if you're working with the premise that you can memoize any function
 
9:42 AM
not with that memoizer
 
But I've seen memoizers for underscore..
Hmm, maybe it converts the function to a string and then re-evaluates it, replacing recursive calls with their own function?
 
actually, in this case it works even without a recursive "formula"
memoization of a function is external to that function
you don't need to mess with it
 
you do if you want to optimize
 
in the page Hawk linked they made one that deals with recursive calls
@Neil not sure what you mean
 
function fib(n) { return n >= 2 ? fib(n - 1) + fib(n - 2) : n; }
Take that example. If you were to memoize it, you'd have to modify fib.. to my knowledge, you couldn't just pass it to a memoize function
Or at least, the memoize function would have to modify fib
 
9:48 AM
not really
but if you don't you won't save the recursively calculated values
so memo_fib(9) would save the output for 9 but not for 2-8
which is what they added in that example
 
Oh, I think I get it now
Not like you pass fib to memoize func in order to memoize.. fib calls memoize func directly
So it's as I thought.. you can't convert a normal recursive function to memoize without modifying the recursive function itself
 
memoization is easy. Sure you can
function fib(n){ return n < 2 ? 1 : fib(n-1) + fib(n-2); }
 
@BenjaminGruenbaum Ok, either I'm not getting something or you're wrong
 
var oldCall = Function.prototype.call;
var results = {};
Function.prototype.call = function(){
    if(this.name === "fib"){
         if(results[arguments[0]]) return results[arguments[0]];
         return results[arguments[0] = oldCall.apply(this,arguments);
    }
    oldCall.apply(this,arguments);
}
Something like that
 
Explain.
 
9:55 AM
Didn't say it wasn't ugly :D
Basically, overriding how calling a function works in the language.
 
you can also keep the old function around :P
 
Hmm, you see I didn't know you could do that
 
@Neil basically - that part. You can modify how the function works internally.
It's just an extremely bad idea.
come to think about it, I wonder if you can hack around it with less overhead.
 
Well you're still not modifying how it works, you're simply interjecting before each call
Something like how proxies in java work
 
Yeah, that was the point. And to be fair, it is being changed in a way.
Yeah, JS is a lot more powerful than Java in that. It's more like how something like Spring AOP or AspectJ works in Java
 
9:58 AM
Not generally a good idea, but it's nice to know you can
 
Great for debugging hostile code
I wish it was standardized
 
What do you mean by standardized?
 
In all honesty I'm not sure if/why/when that sort of AOP works in JavaScript
I guess it could make a good question
 
I think something as complicated as this doesn't have a on/off switch
You need every line because you can't describe it in simpler terms, really
 
10:00 AM
hmm
I think this would work too
 
Hmmm
 
fib = _.memoize(fib)
 
@Mosho That must be how they do it
Though would be interesting to see the code for it
 
function memoize(func, resolver) {
      if (!isFunction(func)) {
        throw new TypeError;
      }
      var memoized = function() {
        var cache = memoized.cache,
            key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0];

        return hasOwnProperty.call(cache, key)
          ? cache[key]
          : (cache[key] = func.apply(this, arguments));
      }
      memoized.cache = {};
      return memoized;
    }
but yeah, giving it the same name works nicely
it seems
overriding it, I mean
 
user2985029
where does isFunction come from?
 
10:08 AM
their script
 
user2985029
i googled it and it came back as something that's in jquery
 
it's in many things
 
function isFunction(value) {
      return typeof value == 'function';
    }
 
user2985029
i tried out that code jsfiddle.net/mE63r not sure if i'm using it correctly
 
user2985029
what should resolver do?
 
!!doge function,inline,elegant
!!live
 
@neil ... charge to 600, clear?
 
10:27 AM
@DrogoNevets ¯\_(ツ)_/¯
 
var oldApply = Function.prototype.apply;
var oldCall = Function.prototype.call;
Function.prototype.apply = function(){
    console.log(this.name,arguments)
    return oldApply.bind(this)(oldApply,arguments);
}
 
nice channel name
 
in this:
 for (var j=0, le=oData.aaData.length; j<le; j++) {
why does jshint complain:
'le' was used before it was defined.
 
@Neil do we know what has happened to our dear belovéd?
 
@FutuToad It's not elsewhere in the code before that ?
 
10:39 AM
nope
 
@FutuToad because it's a variable redeclaration
 
maybe just put "var le" at the top of the function?
 
for(var i=0,j=1... declares a new variable j
In strict mode (which you should have been using anyway) it wouldn't run.
 
am I not just doing:
var le=oData.aaData.length
 
@BenjaminGruenbaum What am I missing in jsbin.com/cotag/1/edit ?
 
10:42 AM
@dystroy "use strict"; not "use strict;"
 
yes, but runs anyway
 
What's the problem?
This is what OP has jsbin.com/dodiqoje/1
 
didn't you say this code shouldn't run in strict mode ?
 
Oh hmm, it shouldn't, does it?
hmm
 
@BenjaminGruenbaum yes it does
 
10:45 AM
@FutuToad can you dump the code ?
 
@dystroy open the console, there is no output to web screen
 
@DrogoNevets there is for me :\
 
the code runs without strict mode:
for (var j=0, le=oData.aaData.length; j<le; j++) {

                          else {
                            oData.aaData[j][i] = icon_span + txt_val;
                          }
                        }

                      }
 
i know this will be probably stupid question
function a(callback) {
var something = 10;

callback();
}

a(function() {
console.log(something);
});
I know that i can pass param "something" to anonymous function, but because closures and fact that execution context is created on calling function i expected this to work
 
10:46 AM
Just discovered harmony, and oh my, it's so much fun :D
 
It is, we've been playing with generators all day yesterday @RoelvanUden
Me and copy did this yesterday jsfiddle.net/jShgZ
 
@dystroy :S oh
 
@FutuToad that's not the same code, you don't have var here
 
Look at the toArrayAsync() version, it runs a generator, sequential flow control
 
@DrogoNevets You hadn't click the "run with js" button, right ? :)
 
10:47 AM
@BenjaminGruenbaum That is awesome! :-D
 
@dystroy sorry updated
 
@RoelvanUden you have to use Chrome Canary for it to work though
 
@dystroy no i have, i get an empty web page, and some console logs
 
@FutuToad seriously, what should jshint do with that syntactically invalid code ?
 
@BenjaminGruenbaum Doesn't matter IMO, it's the future and it will come. With Node, it will be stable in 0.12 so I'm really looking forward to that
 
10:48 AM
ahhhhh! wedding invitations have been printed!!!!!!!!
 
@RoelvanUden oh, I use it today in production, works just fine with the --harmony flag in 0.11.13 with Bluebird coroutines, which are actually faster than plain callbacks.
Promises + coroutines give me async/await control with Promises for Tasks
You can return a value to a JS generator when you call it's next by giving it a parameter. JS generators are expressive enough to build async/await with them in about 15 LoC
 
@dystroy can't you declare and assign on the same statement?
 
You can even throw in them
 
var j=0, le=oData.aaData.length
 
@FutuToad yes, this is valid
but the code block you post isn't
 
10:52 AM
@RoelvanUden so if I add 3 lines to my toArrayAsync, I have effectively created async/await in JavaScript
proto.toArrayAsync = function(val,terms){
    var q = Promise.resolve();
    var arr = [];
    var tNext = this.next.bind(this);
    q = q.then(function cont(a){
            var n = tNext(a);
            if(n.done) return arr; // stop condition
            if(n.value.then){ // thenable
                return n.value.then(function(val){
                    arr.push(val);
                    return val;
                }).then(cont);
            }
            arr.push(n.value);
            return cont(n.value);
 
ignore the rest :)
this is all I care about:
for (var j=0, le=oData.aaData.length; j<le; j++) {
 
This doesn't make jshint cry
 
hmm I still get
  'le' was used before it was defined.
ill look for a global le
 
not me. I typed this in jshint :
var oData = {aaData:[]};
for (var j=0, le=oData.aaData.length; j<le; j++) {
}
jshint said it was fine
 
Here is a full replication of async/await with native promises:
function await(gen){
    var q = Promise.resolve(), arr = [], tNext = gen.next.bind(gen);
    q = q.then(function cont(a){
            var n = tNext(a);
            if(n.done) return n.value; // a `return`
            if(n.value.then){ // thenable
                return n.value.then(function(val){
                    arr.push(val);
                    return val;
                },function(err){ gen.throw(err) }).then(cont);
            }
            arr.push(n.value);
            return cont(n.value);
Without any language support
 
10:56 AM
@dystroy maybe its my jshint version
hmm even this:
var le;
gives the same error
'le' was used before it was defined.
 

« first day (1332 days earlier)      last day (3619 days later) »