« first day (94 days earlier)      last day (4856 days later) » 
00:00 - 14:0014:00 - 21:00

2:00 PM
@Wolfy87 you know you dont have to set the date as global right?
var d; works just as well
@Wolfy87 what do you use to write docs?
 
Oh sorry, I was writing, and I set it as a global because the callback is run via timeout when the animation completes so the d variable would not be in the scope of the callback
And I set a small site for my library so I just add it to there. The site is written in Kohana (a PHP MVC framework) so I just add more views for the functions I write.
 
@Wolfy87 but you create the callback in the function and thus you can reference var d; because of closures
jsfiddle.net/4jUpv/3 It works just fine because its a closure
 
Oh, I never knew that, saves me making globals next time :D
 
woohoo we got the oldest sort order back
 
@Wolfy87 yes any function declared inside another can use the variables of the outer function.
 
2:11 PM
1
A: Bring back the 'oldest' sort order for answers

Jeff AtwoodAfter some contemplation, I agree that "oldest" is more unique than "newest", in that "active" is very similar to newest in practice. So I replaced "newest" with "oldest", this will go out in the next deploy, sometime in the next 12-24 hours.

 
nice!
 
@AndyE o/
 
Done. v1.4.2 is all done.
 
@Wolfy87 its in sync with the jquery versions :P
 
Seriously, oh yeah, they are coming up to v1.5.0 xD
Oop, navigated away >_>
jQuery is on v1.4.4. So close but no cigar.
jQuery has been in development for something like 6 years I think. I have only been working on mine for like 3 - 5 months. jQuery just feels like it has been around for ever.
 
2:25 PM
Not so much ideas for the lol button :(
 
Huh?
lol button? Sounds...cool.
 
@ClemDesm it lacks elegance and/or proffessionalism.
 
6
Q: Adding a "lol" button.

ShikiryuSo, we were talking in the JS chatroom and we came linking the noobiest questions possible, questions you can't really answer... For example : Javascript Math Functions HTML doesn't stop how to change this code What does document.form mean in javascript? Because sometimes, we need it, a "lo...

 
I like that one...
but def the "Google it" idea... Or a "You're Doing it Wrong" button, but then again that should be explained in a comment...
 
How can i add .keypress in general?
 
2:29 PM
Huh? .keypress?
Oh, you mean listen for a keypress event?
 
example if i want to give alert when you press left or right arrows
and i just want that in general to listen
 
Okay, just a sec
 
not that you press in a input type field and then use the arrows
 
I will get you a little snippet
 
ok
 
2:31 PM
@Karem jQuery? or vanilla?
 
jquery * sorry not mention
 
if(element.addEventListener)
this.elements[e].addEventListener(type, function(event) {callback(Spark.fixEvents(event))}, false);
else if(this.elements[e].attachEvent)
this.elements[e].attachEvent('on' + type, function(event) {callback(Spark.fixEvents(event))});
Oops
Wait
I was still editing it >_>
 
in jquery please
4
 
Oh right
 
lol
 
2:33 PM
.keypress(function(event) {
if (event.keyCode == '39') {
event.preventDefault();
alert('You pressed right arrow');
return false;
}
});
But what selector should i use for "general"
the whole page..
 
@ircmaxell is a big fan of yours @Karem
 
if(element.addEventListener) {
element.addEventListener('keypress', keyPress);
}
else if(element.attachEvent) {
element.attachEvent('onkeypress', keyPress);
}

function keyPress(e) {
// Code here
};
 
Huh?
 
That's pure JS btw
you just have to do var element = document.getElementById('someID'); beforehand
 
@Wolfy87 I was looking for jQuery way of doing this
 
2:35 PM
3 mins ago, by Karem
in jquery please
 
@ClemDesm ?
 
>_> derp, sorry about that.
 
lol
 
@Wolfy87 my fault, didnt mention
 
More like I didn't read.
Okay, so I would do it like this.
 
2:36 PM
@Karem $(document).keypress(...) works for me
 
$('div.someClass').keypress(function() {)
I keep hitting enter...
But yeah, do it like you usually would THEN~
 
There's nothing wrong with using jQuery... It's the whole mentality that you can't do it any other way that kills me. So there's no problem here...
 
Use $('div.someClass').focus();
 
@Mefcorvi great!
 
2:38 PM
Of course it prints twice because its attached twice :)
 
@Wolfy87 You cannot focus on a div. You have to focus on any focusable elements (like a link or an input field) inside it before you can handle keypress in that way.
 
@Raynos also nice solution but i was looking for the selector for the "general/global" for the whole page.., which was document..
 
@Karem window is also a general global selector for the whole page
so is document.body
they all work.
 
@MeFCorvi Oh, I could have sworn I have done it like that before.
 
0
Q: Stack Exchange Achievement Suggestions

Tom GullenMaybe we could have some alternative achievements? http://teamfortress2.fr/achievements.php?eng

^ Let's make some good ones :D
 
2:42 PM
@Raynos so document, document.body, window?
 
@Karem anyone, they all work in case when you need to create a global keypress handling
 
@TomGullen I love it +1 !
 
lol someone replied thinking it was serious
 
you should put the [fun] tag
 
thx i will
 
2:49 PM
ok thanks for that
 
3:03 PM
@TomGullen
0
A: Stack Exchange Achievement Suggestions

Shikiryu (cf : Adding a "lol" button.)

 
lol @ friday hater
 
fart is funny ;)
 
Hi! :)
 
3:18 PM
You should definitely get a real gravatar.
 
@ClemDesm I know.
 
Then do it.
please.
 
Word
 
I have a large javascript objects representing a data structure. Which is mirrored on the server and in the DOM. What would be the best way to handle sanity checks whilst debugging like checking there all in sync ?
 
write a hash function
 
3:27 PM
or make @IvoWetzel do it for you.
 
@IvoWetzel can you do it for me?
@ircmaxell a hash function would be sensible.
 
lol...
 
I wish I could participate to an open source project :|
 
I want to use some document generator in my project. What do you think about "dox" (github.com/visionmedia/dox)? Can you recommend something autodoc system?
 
HTML5 got an official logo
 
3:43 PM
You can @Clem
 
Mmm... They sell t-shirts with new logo :)
 
@ircmaxell Well I can, but I can't find one I like enough to go for it.
 
@Mef I use natural docs
 
that's my problem too
 
@Raynos Thanks! Is seems interesting.
 
3:50 PM
@MeFCorvi I only use it because I dont like these xml things clogging everything up. If your really careful it can double as both useful comments and auto documentation
 
is looking for a real Gravatar…
This badge – which doesn't exist yet – is actually impossible to get, because it's impossible to downvote comments!
 
@ircmaxell does JSON.stringify count as a hashing function?
 
4:06 PM
@ClemDesm Defenders of teh semantics!!!
 
ok let's start doing that personal homepage... a barebone express.js template alone won't cut it...
 
@Raynos I think browser-specific function cannot be used as hashing function.
 
4:19 PM
@YiJiang U should put it in your JavascriptGarden !
@Nyuszika7H That's why it's fun
 
@ClemDesm I know :)
 
No idea
actually, take JSON.stringify and then pass that through MD5...
the goal is to have a short checksum rather than transmitting the entire data
 
@MeFCorvi but JSON.stringify(a) === JSON.stringify(b) is fine as long as JSON.stringify is used in the browser alone
@IvoWetzel you have a page?
 
4:49 PM
@Raynos Not yet
 
3
A: Stack Exchange Achievement Suggestions

Shikiryu (cf : Adding a "lol" button.) EDIT : new ones

new ones
 
@Raynos Hm. In browser context it's true, but I think you want to use it to syncronize client-side data with server-side.
 
@MeFCorvi Actaully I just wanted to synchronize client-side data with DOM data. as in javascript objects and html. Since the javascript object is controlled completely through ajax callbacks I can assert its state is in sync with the server.
 
5:08 PM
uuaaargh!
 
Can anyone explain what reduce does
 
Did you know that you can speed up Math.something() by caching the reference to the method? That's horrible! gah
 
@thejh Well actaully object getter overhead. Don't do it.
 
@Raynos Don't do what?
 
@thejh dont micro optimise minor overhead like that. Might aswell inline the function. Actaully get the user to download an activeX control to run assembly
 
5:11 PM
It only really helps when it's in local scope anyway
if you have to go up 5 scopes...
then you can just as well do the property lookup
 
@IvoWetzel can we abuse activeX or something else that's horrible to run assembly on the client?
 
@IvoWetzel going up one scope seems to be still faster
 
@thejh it's also still on the realm of I don't care that its faster its unreadable.
 
@Raynos heh, cool idea. we could use java or so to speedup web page display. "exploiting java to run the websites code faster, please wait..."
 
Computation time is cheap. Developer time is expensive
 
5:13 PM
In most JS engines the number of levels up the scope makes almost no difference in time
 
@Raynos no, I've found this project and am trying to optimize everything: github.com/evanw/rapt
 
-.- Make optimisations that matter
 
and I think that for JS games that redraw the screen many dozen times per second, it's a good idea to optimize the code
 
@thejh I'll get round to writing an optimised canvas utility one day. @IvoWetzel will beat me to it.
 
@gsnedders Hm, I made some different observations at times where scope look up did matter, but then again, micro optimizations
 
5:17 PM
@thejh you really want to make high level optimisations. Like making stuff thats O(n) or O(n^2) into O(ln n). Failing that you can just profile and do significant hand optimisations
 
by the way: currently, I'm not making the code unreadable, I'm just optimizing the order of commands so that their optimizer (that I'm also extending) can optimize it better
 
@thejh by their "optimiser" do you mean the closure compiler?
 
@Raynos what's a good way to profile js?
 
@thejh firebug, ie & chrome all have a profile button, console.profile console.endProfile
 
that script avoids allocation of new vectors and inlines stuff
 
5:19 PM
 
@ClemDesm you find me one that runs at 60 fps in ie and I'll be impressed :). Most of those can't hold up a steady framerate.
 
@Raynos IE? argh
 
@Raynos You don't play JS game on IE.
It's like playing flash game on iPad.
 
@ClemDesm fine 60 fps on FF3.6. I've had a look at quite a few and they are not smoothly playable
 
5:41 PM
I hate CSS
CSS is IMO more broken than JS
 
Hi! :)
 
I just want to center some text vertically ._.
 
NOOOO
 
lol
 
how was the relation between sin(x) and cos(x)? sin(x)+cos(x)=1?
 
5:46 PM
^2
sin(x)^2 + cos(x)^2 = 1 IIRC...
 
@ircmaxell seems like that's right
 
since sin(45*) == root(2)/2, root(2) / 2 + root(2) / 2) != 1
 
6:25 PM
uaah. there's a spike ball in the game. and each tick, there are calls to Math.sin and Math.cos. Now I'm caching the data in the constructor :/
 
Opera.
Sucks
Looks the same in Firefox and Chrome
Looks like ....
sigh
opera doesn't set display: block on article and header
 
6:45 PM
fights IE6 to make it use async.parallel
 
I hate CSS so much
 
@Ivo just use string.bold()
 
inconsistent beyond repair
 
lol
 
especially the font rendering
Chrome and FX render some stuff identically
Opera...
 
6:46 PM
use Canvas and render your own fonts!
 
lol
 
!!!!!!!
Now it looks the same in Opera and Firefox
But chrome... ;_;
 
and you broke IE completely!
 
I haven't even tested on that
And all I changed was the font-family
sans-serif looks exactly the same in FX and Opera
but it looks like crap in Chrome
That's why I hate webdesign
Code is so much easier to work with
 
you have to give up a certain amount to the browser.
let go.
breathe.
it'll be OK, really
 
6:58 PM
No it's not ok
because chrome renders the font about 20% smaller...
 
I can't think of a reason for that... is it a header?
 
no it's using a different font I guess
 
the browsers have widely differing default sizes for headers
 
Which doesn't make sense since both Firefox and Opera use the same one :/
I already set the size for the header
Also, it's rendering all the text on the page different
 
if you care, you should use a more specific font-family before sans-serif.
 
7:02 PM
Hey all, how is everyone?
 
hi @Darren
 
Anyone here familiar with Ext.Direct?
 
nope
 
Anyone use Aptana?
You here they got bought/
 
ok
enough for today
basic "design" is done
missing... some colors hm
 
7:13 PM
in ur office?
 
looks exactly (pixel perfect) the same in FX and Opera, and Chrome,gnah looks cose enough
 
convinces IE6 to work!
 
@Nathan Now try convincing NN4 to work
 
been there. I just found this note in some 1998 javascript I wrote:
`To remedy this problem, you can either turn JavaScript on (Netscape 2.0+, IE 4.0+) or use a different browser. If you are using a version of Internet Explorer prior to 4.0, you may be able to get it to work by <a href="...">downloading the latest scripting engine</a>. This program has been tested and works with Netscape 2.0-4.0 and IE 4.0.`
 
:kitten quote show code
 
7:23 PM
> "Talk is cheap. Show me the code." - Linus Torvalds
 
+1
 
:kitten quote hubris
 
> "Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall
 
:kitten jquery
 
7:24 PM
beams
IE6 will run FirebugLite, which has console.log(), but evidently no console.dir()
 
8:11 PM
@IvoWetzel oh did you really want to see that 1998 code?
 
@Nathan Sure
 
i guess most of it is from 1996-97 actually
 
ahhh the lovely blink tag
 in1h= eval("f.in1"+day+"1.selectedIndex");
 
uh yeah
 
and that's just one of approximately 5k eval calls
 
8:16 PM
I generated most of the javascript with the perl CGI
 
I guess I could've generated a hard string there instead
well, at least, unlike my employer's modern-day Enterprise timecard app, it worked in more than one browser, and it let the user save their "normal" schedule which made filling it out easy.
ah, looking at it more closely it is pretty barbaric. I didn't understand JS very well so I did as much as possible with Perl
 
8:30 PM
Hi! :)
Will (!$('#myDiv')) return true if #myDiv doesn't exist, or do I need to use ($('#myDiv') == [])?
 
> $('#myDiv')
[]
> !$('#myDiv')
false
 
side note [] == [] is always false
 
isn't there an .exists() or something?
 
@IvoWetzel tried it out, you're right. but why?
 
if (!$('#myDiv').length) { … }
 
8:37 PM
ah, understood
not the same instance
 
@thejh exactly
==/=== only test for equality on primitives
 
@thejh {} == {} is false too
 
as soon as one object comes into the mix they check whether both operands are the same instance
 
this "official" tutorial recommends using .length
 
Is this correct? ($start.length) ? $start.click(musicReq) : musicReq(); My userscript should only do something if the chat is started in a page ($start doesn't exits)
 
8:50 PM
@Nyuszika7H if $start doesn't exist, you have to use typeof
typeof $start == 'undefined'
 
@thejh Nope. !$start.length is fine. Remember, it's jQuery!
 
@Nyuszika7H how can jquery catch the nonexisting variable $something?
 
@thejh This is the first line in my code: var $start = $('#chatstartdiv');
 
ah, ok
so $start does exist
 
00:00 - 14:0014:00 - 21:00

« first day (94 days earlier)      last day (4856 days later) »