« first day (1474 days earlier)      last day (3489 days later) » 

8:00 PM
Use AtScript and use an annotation. That'd solve your problem.
( If you don't mind using a week old, not yet specified programming language that is :D )
 
Jeebus another compile-to-JS language
 
It's actually the same, they have a nice graph
 
CocaineScript
 
8:01 PM
@BenjaminGruenbaum Ugh, Angular 2.0
don't remind me
 
Insane :-/ I went for JS instead of TS for the simplicity anyway.
 
@SomeKittens there is no magic solution though, you can denormalize.
Mongo is just... not very good.
 
Yeah, I used postgres for Card Minion and it wasn't bad
 
CouchDB
 
var length:int = name.length; is kinda weird looking to have the type trail after the name
 
8:03 PM
It's not just Postgres, even MySQL is much much much better than working with Mongo.
 
@BenjaminGruenbaum I dunno what makes you say that :P
 
Couch is decent, Redis is decent, Raven is decent, most of these have a predefined use case they're good at.
 
Is there a shorter way to write this with Jquery?
var text = "";
    if (window.getSelection) {
        text = window.getSelection().toString();
    } else if (document.selection && document.selection.type != "Control") {
        text = document.selection.createRange().text;
    }
 
@SecondRikudo working with both for years, mostly.
 
I'm working with mongo and I'm enjoying it
 
8:04 PM
@BenjaminGruenbaum so Mongo sucks :?
I'm starting a project and was going to use mongo
 
My coworker has mongo as the base for his 3-years-old business and he still hadn't had data-loss or downtime
 
@SecondRikudo just wait :D
 
mainly because it seems easy to integrate with Azure
 
@Loktar what's wrong with sql azure?
@SecondRikudo you never wanted a transaction?
 
we are storing a ton of data that a relational DB didn't seem appropriate for
 
8:05 PM
@SecondRikudo no hockey stick I guess?
 
@BenjaminGruenbaum I wouldn't have used Mongo had I wanted one.
 
like recording a users movements + clicks on a page
 
> I'm glad [the Antares rocket] exploded. Why are we supplying ISIS in space anyway?
 
@BenjaminGruenbaum Hockey stick?
 
also I just made the assumption mogo + node interacted better together
 
8:05 PM
@SecondRikudo so you never perform any action on two different entities, or perform related actions on entities?
 
I mean.. getSelectionStart isn't cross browser and has problem with internet explorer
 
@SomeKittens lmao wow
 
@BenjaminGruenbaum That's right
 
@SecondRikudo big growth, a growth graph that looks like a hockey stick.
 
thats why I expected Jquery to have a crossbrowser function
 
8:06 PM
My data is modeled in a way that all of your I/O is done in onne bang.
 
@BenjaminGruenbaum Do you happen to know of a fs promisify with Bluebird without having to manually write code for exists?
 
Admittedly, my data is relatively simple,
 
@SecondRikudo I hope you're not talking about your thing with your friend we talked in person about, Mongo there is crazy.
 
mixam.co.uk << My coworker's business
 
@BenjaminGruenbaum soooo angular js is now microsoft + google attempts ?
wonder why didn't they made it in dart :3
 
8:07 PM
@darkyen00 they did
 
@BenjaminGruenbaum Remind me? XD
 
@phenomnomnominal as in a pure dart project.
 
@RoelvanUden you should not be using exists in the first place most of the time since there is a race condition in case the file exists when you ask and doesn't when you try to open it - leap and ask for forgiveness instead.
 
exclusively
 
8:07 PM
itemCount += parseInt($(".qty").attr('value'));
good lord
we must educate!
 
@SecondRikudo EBay related thing.
 
did someone mention me?
 
@darkyen00 AtScript compiles to dart :P
 
@BenjaminGruenbaum It actually is, for most of it.
 
Our code has now thwarted two people's attempts to debug it
 
8:08 PM
@BenjaminGruenbaum It's necessary for my use-case. I'm aware of the possible race-condition, but that's completely non-applicable when you're using it to decide whether or not to go ahead and download a book or not.
 
itemCount += +($(".qty").attr('value'));
better one ;)
 
Payment related stuff will go in a table-based DB with transactions.
 
"+" acts like "Number()"
 
@SecondRikudo Well... I don't have much to say except - "good luck, you're gonna need it".
 
@BenjaminGruenbaum I dunno man, working great so far :P
Don't jinx me
 
8:09 PM
@RobertMallow I was referring to attr("value")
 
@RoelvanUden in that case, you want stat instead of exists anyway, does the same thing and isn't broken API (reports errors correctly etc). fs.exists doesn't let you know if the operation failed because of permission, or the file didn't exist, or whatnot.
 
@BenjaminGruenbaum hahaha
 
Unary conversion, parseInt, Number(), all the "same"
 
@SterlingArcher ah hahaha right right that one sucks
 
8:09 PM
@BenjaminGruenbaum stat throws when the files does not exist tho, is that normal?
 
you missed one
 
@SterlingArcher parseInt is different.
 
Unary always makes me think of urine
 
@RoelvanUden you mean errors?
 
@BenjaminGruenbaum don't judge, some functions can't help the way they are
 
8:10 PM
@SterlingArcher Try parseInt and "+" and "Number()" with "text134"
:)
 
@BenjaminGruenbaum yeah I was being lazy, that's why I went with "same" lol
 
@SterlingArcher all functions belong to the same race, huh?
 
@RobertMallow don't worry, I know the differences, I'm just lazy and tired
 
@BenjaminGruenbaum Hm, yeah, that.
 
@SterlingArcher ok :)
 
8:10 PM
@RoelvanUden exists is basically a relic of the past, it calls .stat internally.
 
Thanks though
 
@SterlingArcher don't thank me man its fine :D
 
@RoelvanUden kriskowal has an async-fs module but I'd just use statAsync and catch file not found errors.
 
THANK. YOU. >=(
 
@RoelvanUden in fact, I'd just try working with the file and catch io errors. If you're aware of the race condition avoid it.
 
8:12 PM
lol :D
 
btw, someone told me that it's good practice to always specify the second parameter of parseInt, even if it's 10. Like parseInt('1337', 10)
is that something that people actually do?
 
yes
 
@towc it depends on which radix you're working with
 
the best way is regexp, hands down. Number("text134".replace(/[^\d+]+/g, ''))
 
usually it's not needed
 
8:13 PM
@BenjaminGruenbaum Like I said, it's to determine whether or not to start downloading something of the internet. Makes no sense to start scraping a book you already have. But I'll go ahead and try stat, although it feels incredibly dirty to catch an error for a simple if exists
 
What are the chances of cosmic radiation consistently flipping one bit at the same time every test run? Because that's starting to look like a possibility.
 
radix 10 is the default anyway
 
^ not guaranteed
 
@rlemon except in strict mode.
 
!!> Number("text134".replace(/[^\d+]+/g, ''))
 
8:14 PM
@RobertMallow TypeError: property "a" is non-configurable and can't be deleted
 
@RoelvanUden yeah, I get what you mean there, it's annoying that exists is broken.
 
lets open firebug..
 
Attention All: The bots eval command is foobar'd - it doesn't work. will update when fixed. kthxby!
 
@RobertMallow even then: do people write parseInt(stuff, 10) in production code? Even if it's just for good practice
 
8:15 PM
@towc I use Number almost always, it's the clearest and simplest.
 
@rlemon alright thanks .. ill be using firebug anyway :D
 
when I've used parseInt I use the radix, if you don't your linter should yell at you anyway
 
I always supply a radix as well
 
@towc I wouldn't. but there's freedom of writing of course
 
@rlemon foobar'd?
 
8:16 PM
you want to be sure what you're working with before evaluating that choice
 
yea it's my fancy way of writing fubar
 
fubar? D:
 
anyway it's a few chars more so it doesn't hurt
 
I don't like fubar, foobar is more nerdy
fubar = fucked up beyond all repair
 
if you're paranoid put it there
 
8:16 PM
if The Lemon and The Loktar put the radix, I'm gonna put dat radix aswell for sure
 
@towc if all your friends pooped on a slide...
 
Yep. It's called "Freedom of Programming"
 
@RobertMallow No, you put it there.,
 
likr speech
 
@BenjaminGruenbaum don't use that slide :/
 
8:17 PM
It has nothing to do with being paranoid.
Try running parseInt('09') to understand what I mean.
 
To be fair, MDN suggests always providing a radix (if that's what we're talking about)
 
@towc at the end of the day, unless you have good reason to use parseInt, use Number to cast strings to numbers
 
@BenjaminGruenbaum You're not my friends, you are my masters
 
> radix
An integer between 2 and 36 that represents the radix of the above mentioned string. Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified.
 
8:18 PM
!!afk vape
 
@SecondRikudo It gives "9", what's the problem?
If you're incrementing an html counter you wouldn't worry about "0ed" vals
 
@RobertMallow if there is a 0 before the number, parseInt defaults to octal
 
it all depends on what you're doing
 
@SterlingArcher well....
 
8:19 PM
@SterlingArcher Oddly enough, it doesn't :o
 
@BenjaminGruenbaum Hm, promisfyAll modifies the existing object. Is there a way to avoid this?
 
@SecondRikudo yeah, ES5 and all.
 
@SterlingArcher Hehe
 
8:20 PM
@BenjaminGruenbaum what do you prefer -- Number() or +?
 
So the radix is only needed for xbrowser?
 
@SterlingArcher That's faulty
 
@SterlingArcher wuuuuuuuuuuuuuuuuuut?
 
Altough parsing that sort of numbers isn't so common among devs
 
@SterlingArcher out of those only one is readable.
 
8:21 PM
But is a possibility
 
@SecondRikudo I wouldn't say just but still.
 
@BenjaminGruenbaum err, readability aside. Does Number provide advantages over + or vice versa?
 
@SterlingArcher 012 is an integer literal, it doesn't need to be parsed to be 10
 
@RoelvanUden not sure why you'd care but IIRC there is, someone asked about it and Petka answered, search the issue tracker.
 
I use it mainly to convert numbers inside dom elements
 
8:21 PM
Don't store data in DOM
 
right. just checked on firebug
 
@SterlingArcher still, parseInt('012', 10) works as expected
 
@copy that's true, parseInt("012",10) = 12, so why parse 012 when it's already int
 
@copy I'm not storing data in DOM
 
just don't put numbers?
 
8:22 PM
I use it for a view counter
for example..
 
@SterlingArcher Exacly
 
@SterlingArcher yes, + might be the tinyest bit faster because you can't get +x to do anything other than what we know Number(x) does but you can do var Number = foobarbaz; reassigning it. Just like void 0 is faster than undefined - a literal is always faster than a loop up. Like I said - if you need to convert strings to numbers that's negligible anyway.
 
@RobertMallow You're storing the old value of the counter in DOM
 
@SterlingArcher wait... that's just the number itself being weird... logging 012 returns 10
 
8:23 PM
@copy it goes away after a refresh
 
Also, @copy is right, if it's not user input you shouldn't convert it back and forth anyway.
 
not parseInt's prob
 
@towc octal
 
@SterlingArcher Bees
 
what would you suggest to increment a view counter?
 
8:23 PM
++
 
32
Q: Code that converts a value into a different representation, then converts it back to where it started is bad, but how?

user13107I was reading an article about bad programming practices. It mentioned - "Yo-Yo code" that converts a value into a different representation, then converts it back to where it started (eg: converting a decimal into a string and then back into a decimal, or padding a string and then trimming i...

 
@KendallFrey lol you can't "++" a string element :)
 
@SecondRikudo such pixels!
 
without converting to number
 
your counter int shouldn't be stored as a string in the first place
 
8:24 PM
^, also Woah my comment there got 57 upvotes.
 
> Code is like poetry. Most of it should have not been written.
 
Not as a string but especially not in the presentation layer
 
Is it any worse than my avatar? :P — Sterling Archer Jul 31 at 17:48
96 :3
 
lol
 
8:25 PM
lol, nice.
 
@rlemon how do you store a number in a dom element? I store it as a number but it ends up as a string when the page loads
 
I love that people upvoted that so much
@RobertMallow you don't store it in the DOM
 
@SterlingArcher - Is there an easy way to find your highest voted comment?
 
the DOM is for displaying it
 
I lol'd so hard when I saw it wasn't going to get me flagged
 
8:25 PM
store it in memory
 
@TravisJ not that I know of. I think there's some sort of data.stack site you can query on
 
var counter = 10;
elm.textContent = counter;
// later
counter+=1;
elm.textContent = counter;
 
@SterlingArcher data.stackexchange.com
 
yeah, I know about the querying :)
 
there is no reason to convert it back and fourth
 
8:26 PM
Just thought there was a 1 click wonder somewhere
 
Nawww
@Zirak tybb
 
@RobertMallow Just wondering - where did you get that avatar?
We used to have a user here with that avatar.
 
@BenjaminGruenbaum I cheated pastebin.com/1BRuUtgh
 
he has a throw away email
can't remember the site
there is a meta issue about it from the last person who abused the chats ;)
 
@rlemon let's be clear about this. I store the value in the database and then I do something like this: <div>{{count}}</div>. when you click upvote the value inside <div>{{count}}</div> is incremented as an AJAX operation
 
8:28 PM
wut?
 
@BenjaminGruenbaum I believe that avatar is a system fallback or something? I can't really remember
 
@RoelvanUden that's legit. Just slow.
 
thats a terrible system fallback
 
like I said, it is triggered by a throw away email from a specific site
 
@BenjaminGruenbaum as rlemon said I'm using a throwaway email
 
8:28 PM
> Need a fallback, gay pride yay!
 
it was put in place because the swastika users were using the same email service
 
I have nothing against gays.
 
@BenjaminGruenbaum Can you explain why this is slow?
 
mmk then.
 
@rlemon Ahhh LOL
 
8:29 PM
I'm not sure why balpha decided to use that flag again
 
that makes sense
 
Or am I missing something fundamental here?
 
@RoelvanUden I take that statement back, it's slower, it's still pretty fast and likely won't be a limiting factor.
 
@RobertMallow me neither especially not any parts of my body (currently)
 
@RobertMallow As we said, SO had trouble with throwaway accounts for some time, so they forced them a specific avatar. They tried to undo it but can't find the code anymore
 
8:29 PM
I'm fine with gays, just don't be blowing your bf in public lol (sadly, speaking from metro experience here)
 
@SecondRikudo the word All after promisify
 
@BenjaminGruenbaum Is not there
 
@copy LOL seriously?
they tried to undo it I mean?
 
@Loktar lol ok
 
Also, promisifyAll returns a void, doesn't it?
 
8:30 PM
@SecondRikudo It works with promisifyAll and then you just need to use methodAsync. It doesn't work on exists because it doesn't have a leading error variable in the callback.
 
@copy mmk that's not so much of a problem
it's an avatar for god sake
 
@RoelvanUden Oh, I'm not talking about your code
I'm looking at the bluebird documentation
 
@Loktar Just joking :P
 
@RobertMallow not sure if its for Gods sake, more like for trolls sake
 
@SecondRikudo where, what line?
 
8:31 PM
@copy ah damn, was hoping it was true that would be pretty damn funny
 
@Loktar huh?
 
> the elusive gay flag bug
 
@BenjaminGruenbaum Boo, you're not fun :P
 
@Loktar not sure what you're going to but I didn't choose this avatar to begin with
 
!!s/ve/vely/
 
8:32 PM
@SterlingArcher TypeError: property "a" is non-configurable and can't be deleted
 
balls, forgot
 
@SecondRikudo :D
 
@RobertMallow its cool man
Its just an avatar just calm down
 
@Loktar aight :)
 
!!s/l(?=ag)|bug//g
 
8:33 PM
@KendallFrey TypeError: property "a" is non-configurable and can't be deleted
 
Some people just are prideful no biggie
 
ohhh. right
@Loktar Some people are prideful of their biggie
 
@Loktar errrm.. lets make clear I'm not gay
 
@Loktar I read that as "the elusively gay flag bug", with emphasis that there is a very elusive, gay flag (flag being personified as a living thing)
 
hahaha
 
8:33 PM
@RobertMallow dude, I have no issues with being gay
 
@RobertMallow it's the internet, we don't care
 
Its alright we're all cool with it
 
shower not a grower
 
don't worry man
 
8:34 PM
ok thanks!
 
not going to treat you any different for being gay brother
 
Well
I might
But I might just ask you for fashion advice
 
Or out on a date
 
@Loktar commas: important
 
is someone gay here?
 
8:35 PM
haha thanks bros love you (as friends lol) :)
@SterlingArcher errrm.. no please xD
 
@AwalGarg some people are gay everywhere
 
@AwalGarg Probably, but see above picture
 
> "bros", "love you", "as friends"
such a sentence!
 
!!doge bros, love you, as friends
 
    wow
                such bros
                          very  love you
so  as friends
 
8:36 PM
@AwalGarg lol it was to be clear :)
 
!!doge friendzoned
 
      wow
much friendzoned
 
@RobertMallow You don't have to deny who you are mate, no one will judge you.
 
Anyone have Inbox invites yet?
 
Dammit I will never get tired of this song
 
8:37 PM
@A.M.K Still waiting on mine.
 
!!youtube johhnys revenge
 
Waiting days and they're impossible to find
 
!!undo
dammit
 
@RobertMallow On the internet, no one knows you are a dog.
 
!!undo
 
8:37 PM
 
@A.M.K I'm afraid I can't let you do that, A.M.K
 
@SecondRikudo :) I won't let interfere my personal preferences interfere other people, even on the net haha
 
Interesting
So... ANYONE have Inbox invites?
 
let's just talk about programming :P
 
8:38 PM
I had one. but I used it. on myself.
 
@RobertMallow I mean, look at who we have here
 
no, let's talk about brogramming
 
There's @rlemon, who is an indian zombie lemon
 
On the internet, no one knows you are.
 
haha :D
 
8:38 PM
There's me, an immortal ninja god riding a unicorn on a rainbow road.
 
@rlemon, Can you check under the plus and see if you have 3 to send?
 
There's you, the rainbow flag
 
Kendall, who is a fry
 
@A.M.K the QR code
 
And Caprica Six, who is NOT a bot.
 
8:39 PM
@rlemon aka Phillip J. Fry?
 
@SecondRikudo your pic is awesome actually :)
 
@Zirak the mustached AWESOME face
 
I don't remember where it goes
Nowhere important
 
I am using a website that uses javascript to post information when I click a link just to navigate to a different page =/
 
@RobertMallow for the record... dunno if anyone told you, but your avatar is an automatic one when the avatar is deemed inappropriate. Last time we saw such avatars, they replaced nazis' swastikas.
 
8:40 PM
@rlemon it's why I'm chubby. It's in my jeans
 
@TravisJ it's the NSA
 
Can't open new tabs!
 
And then there're the boring guys like @KendallFrey @FlorianMargaine and @BenjaminGruenbaum who use pictures of random people IRL
 
@TravisJ gmail does that
 
Oh, the horror
 
8:40 PM
@A.M.K "under the plus" ??
 
@KendallFrey is definitely a stock photo
 
The orange button at the bottom left
 
and FWIW, I like gmail better
 
@FlorianMargaine Nope. I'm a recent user?
 
@A.M.K nothing in there that indicates invites
 
8:40 PM
@Loktar stocky
 
not necessarily
 
@SecondRikudo mine is a picture of a porn star.
 
and that stuff is just awful lol
 
@SecondRikudo You can't say that, having the present gravatar of yours :P
 
Too bad
 
8:41 PM
@FlorianMargaine I'm actually seeing his actual avatar
It's a rainbow flag
 
@SecondRikudo uh? it's a picture of an ancient god that I have as avatar
 
@SecondRikudo you forgot me :(
 
@SterlingArcher I haven't. I'm just not sure how to define you.
 
@BenjaminGruenbaum Your wife does porn?
 
8:41 PM
@Zirak I knew this would come
 
@SterlingArcher is your avatar having something to do with ISIS? :D
 
Not random person IRL?
 
Moreover, I knew this would come from you specifically XD
 
@Zirak holy shit there's a woman in the picture and she's my wife :O?
 
I mean.. the one about that dumb secret agent if I'm not wrong
 
8:42 PM
@BenjaminGruenbaum I always want to click the "click here to edit" link on your profile
well done.
 
!!afk meeting #suckit
 
I heard they changed name after the incident
 
@SterlingArcher you Zoe Quinn you
 
lol
 
8:43 PM
does anyone have an example of any app in any language that shows how to increment a view counter properly?
 
for some reason, I want to talk regex
 
@BenjaminGruenbaum Sorry, your feminine husband does porn?
 
17 mins ago, by rlemon
var counter = 10;
elm.textContent = counter;
// later
counter+=1;
elm.textContent = counter;
 
8:44 PM
@rlemon Know anyone that does have them?
 
@FlorianMargaine Ouch
 
@RobertMallow - meta.stackexchange.com/a/224165/178816 explanation of SE counter
 
@A.M.K no sorry. I applied for mine and they gave me one
 
OK
 
@RobertMallow Other than what rlemon said, if you have a global APP variable, you can set a method to do that.
 
8:45 PM
@Zirak I love you rebecca.
 
@AwalGarg You know I'm always open
 
@AwalGarg You, let's not do that.
 
Thanks guys!
mmm
 
@SecondRikudo hrm? Wrong message linked? :P
 
8:46 PM
Nope.
 
so.. you're suggesting I get the counter value through AJAX?
without "storing" it in the dom but inserting after the AJAX call is done
 
@SecondRikudo why not set a method then, if he is having so much trouble just to increment that thing?
 
@AwalGarg I don't mind the method. It's the global variable that irks me.
 
globals are bad mmkay
 
@AwalGarg interesting. what's that for?
 
8:47 PM
@RobertMallow - You want a live updating counter?
 
@RobertMallow isn't that the whole point of server-stored variables?
 
@SecondRikudo ahh... I know. That's why I said "other than what rlemon said, 'if' you have..."
 
@TravisJ not really "live" but well something like that
 
@KendallFrey matches bad usernames.
 
@towc where do you think SO stores the vote "variable"?
 
8:48 PM
@KendallFrey _ and . not allowed more than once simultaneously
 
how to get kicked from the JS room in 5 seconds set it on window instead
 
@RobertMallow You store the counter somewhere permanent, and increase it on visit
 
it has to persists someway lol :)
 
It's not the difficult to achieve.
 
Live, current, estimate.
 
8:48 PM
@RobertMallow surely not in the dom -_-
 
@AwalGarg odd requirement, but ok
 
Those are essentially the 3 options
 
@KendallFrey only alphabets, numbers, _ and . allowed.
 
@SecondRikudo I already do it: in the database xD
 
<div id="counter-container"></div>

var counterContainer = document.getElementById('counter-container');
(function update() {
  $.get('/counter', function(data) {
    counterContainer.textContent = data.counter;
  });
  setTimeout(update, 100);
}());
 
8:49 PM
guys don't worry I have @RobertMallow covered
^ just paste some of that code on your page bro
 
@RobertMallow php?
 
Live requires push technology and using a websocket. Please don't poll your server for a view counter. Current takes the stored value from a database and displays it when the page is loaded. Estimate is self evident.
 
@KendallFrey sorry see edit :D
 
@AwalGarg but... why not something__like__this?
 
@KendallFrey because I no like it.... but you make sense. I don't see much problem in that now.
ughh! setting the rules is difficult.
Kendall....___frey <-- see the problem?
 
8:51 PM
@rlemon aaaaah that's what I suspected you were suggesting me!
 
@AwalGarg no
 
instead of innerHTML textContent is used. I guess to avoid parsing to int
 
@RobertMallow facepalm
 
no, please read about the difference
 
@KendallFrey :( It doesn't look nice... am I wrong?
 
if users want an ugly name, that's up to them, not you
 
also, move the setTimeout inside of the callback
that was a mistake on my part
@TravisJ nahh brah. let him do it!
 
@Loktar - lol so I checked out that counter
found this gem
 
in a week we'll be answering this all over again with websockets
4
 
8:52 PM
var bro_nom="chrome";
 
lol
 
@RobertMallow every 0.1 seconds it gets the content of the variable from a different file, and applies it to the element: $.get is an ajax call, '/counter' is the file, counterContainer is the element
 
@KendallFrey hmm, agreed. Just curious: I am not saying I am building something of the scale of gmail, but why then gmail not allow . simultaneously more than once in usernames?
 
 get the div value -> var counterContainer = document.getElementById('counter-container');
 start function "update"-> (function update() {
   get the value from the "/counter" url which has the function.. -> $.get('/counter', function(data) {
    set the received value to the div through "textContent" -> counterContainer.textContent = data.counter;
  });
  update every 100ms -> setTimeout(update, 100);
}());
@towc lol I know.. look ^^
 
@RobertMallow that's just wrong
 
8:54 PM
@towc care to tell me what's wrong bro?
 
head over to codecademy.com
 
what are you actually getting from document.getElementById?
 
@AwalGarg you're getting extremely arrogant for a noob
 
@towc nothing lol..
 
I'm pretty sure you can't even finish codecademy
 
8:55 PM
where did I say that?
 
@FlorianMargaine ehh no. I was serious.
@FlorianMargaine lol wut?
 
the value is set up after the ajax call
 
@AwalGarg what's wrong with his code then?
 
Just an element, not it's value. That is just to set stuff to it, with counterContainer.textContent = 'stuff', to set it's text content to 'stuff'
 
8:56 PM
@towc clap clap clap xD
I knew that bro ;)
 
/counter doesn't contain any function
 
@FlorianMargaine codecademy.com/awalgarg skiils completed only one - javascript :P
 
just a number
or many numbers, depends on your case
you just set the element's text content to that number
 
@AwalGarg congratulations, you know the word javascript!
 
beer!> 4
 
8:57 PM
@towc ... "/counter" is the imaginary url to which you go and the server executes a function when that url is hit by the browser
 
@Zirak 4
 
lol
 
then wait 0.1s and retry
 
seriously, don't boast about that
 
I know bro
 
8:57 PM
Closure fucked stuff up.
 
@RobertMallow nooooO!!!! It's a real URL
 
@towc ... xD
 
what's the really wrong thing about @RobertMallow's code?
 
rlemon or someone else will take it from here I think
 
8:58 PM
let say it's a real url then :)
 
@FlorianMargaine where is his code?
 
5 mins ago, by Robert Mallow
 get the div value -> var counterContainer = document.getElementById('counter-container');
 start function "update"-> (function update() {
   get the value from the "/counter" url which has the function.. -> $.get('/counter', function(data) {
    set the received value to the div through "textContent" -> counterContainer.textContent = data.counter;
  });
  update every 100ms -> setTimeout(update, 100);
}());
 
@FlorianMargaine Right, as rlemon said it should be moved inside the func
 
@RobertMallow imagine just a file (txt, html, js, whatevz), which simply contains a number: nothing else
 
8:59 PM
!!refresh
 
@FlorianMargaine that is what rlemon wrote for him
 
!!info
 
@AwalGarg well, that's wrong
 
@Zirak I awoke on Wed, 29 Oct 2014 20:59:07 GMT (that's about 16 seconds ago), learned 234 commands
 
@rlemon bad
 
8:59 PM
!!> 4
 
@Zirak 4
 
10 mins ago, by rlemon
<div id="counter-container"></div>

var counterContainer = document.getElementById('counter-container');
(function update() {
  $.get('/counter', function(data) {
    counterContainer.textContent = data.counter;
  });
  setTimeout(update, 100);
}());
 

« first day (1474 days earlier)      last day (3489 days later) »