« first day (524 days earlier)      last day (4424 days later) » 

4:09 PM
@Zirak got it !
I'll be more zen with that
you can write a whole html page with it !
 
Yes, yes you can, mainly because that's its purpose :P
 
LOL
@rlemon can I make a tabbable that contain a row and 2 distinct span?
 
@Delarn huh?
 
@Raynos yes. And this kind of noob has to use IIS, considering it's the company's box and there's 7 ASP/PHP sites running from it.
 
@rlemon I'm making a tab system in the index page. I want it to show a video or something on one side and text on the other side but being a row in a row.
 
4:20 PM
does that help?
 
@Delarn There's Sparkup (github.com/rstacruz/sparkup) and Zen Coding (code.google.com/p/zen-coding)
 
jsfiddle.net/rlemon/aDhAG/1 container does not need span12
 
Both have vim and Textmate plugins
 
var urlParams = {};
(function () {
    var e,
        a = /\+/g,  // Regex for replacing addition symbol with a space
        r = /([^&=]+)=?([^&]*)/g,
        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
        q = window.location.search.substring(1);

    while (e = r.exec(q))
       urlParams[d(e[1])] = d(e[2]);
})();
^ Anything wrong with readability here?
It reads fine to me, probably because I wrote it. But some guy wants to edit it to have more comments and longer variable names, which I'm not too happy about. Discuss.
 
@AndyE Single-letter variables are kind of annoying to read unless they're an index of a loop.
 
4:27 PM
@Liam: I agree, and it's not very often that I do it, unless it's very obvious what the code does. I may compromise and comment each line instead.
 
just for the guys that were there earlier, here is the countdown finalized: github.com/Ralt/ralt.github.com/blob/master/school/countdown.js
 
is it just me
or internet is being lame tonight ?
 
@AndyE: I'd just use long variables names... your code looks like minified :p
 
Meh, screw you guys, I'm taking my code and going home.
 
Ok I want to control 2 tab-panes at the same time ... is it possible ?
 
4:42 PM
@AndyE
var entity,
    plus = /\+/g,
    entityRegex = /([^&=]+)=?([^&]*)/g,
    decode = function (s) { return decodeURIComponent(s.replace(plus, " ")); },
    query = window.location.search.substring(1);

while (entity = entityRegex.exec(query)) {
    urlParams[decode(entity[1])] = decode(entity[2]);
}
 
listen for the event which is triggering eitehr one and fire the event for other one using that event
 
0
Q: Countdown in javascript

Florian MargaineI've written this little countdown script to count until the end of our school days. Now, that was written quickly, badly remembering modulo from a few years ago, and I don't think that's very optimized. I thought about updating only the seconds and check if it needs to update the minute too, e...

 
ok
 
@Zirak: that's more like what it looks like where I use the code. I used small variables so that it would fit the width of an SO post better :-p
 
@Delarn everything is possible all you need is a basic understanding of javascript
Anybody having internet issues
tongiht ?
 
4:46 PM
@Abhishek I am doinga quick site for my boss using bootstrap ... he want his site to be mobile too ... and he wants me to have it done for next month...
no problem in Montréal
 
@AndyE The readability gain is very minimal - as you said, it's pretty obvious
 
@Delarn okay
bootstrap supports mobile aye ?
 
The long names actually hamper readability a bit inside the while loop
 
@Zirak: yeah, I think so too. I rejected the edit anyway, but I was thinking about adding comments.
 
@Abhishek yes it does. And I found I do the #1 #A in the href="#1 #A"
 
4:48 PM
okay
 
Both panes changes
 
we might be able to help more ^^
 
if you can show us all your code
 
If you want to see ...
lol most of my code is in the twitter bootstrap ... I'm doing mostly htmls ... he is in an hurry so I am giving him just that.
 
4:54 PM
sure show t
 
@AndyE the thing is IIS doesn't support websockets so fix the problem by using a different HTTP server like node
There's no reason node should go behind iis
 
@Raynos wait what ?
 
going to my other job see you!
 
see ya
IIS can easily run ASP.net and asp.net supports sockets
 
@Raynos but then I have to use a different port.
 
4:59 PM
:\
reverse proxy
how hard is it?
Put nginx in front of IIS
or put node in front of IIS
 
ugh...
 
or do DNS based port redirect
whatever you do to load balance across multiple different applications
 
I'll just set up another box.
Node should finish compiling on my NAS in about 10 thousand years, then I can start playing around.
 
@AndyE i still dont see the use of node in it ?
if you need sockets & websockets why not use ASP.net ?
and use what you already have ?? rather then re-doing and compiling stuff ?
 
5:11 PM
weird :/
Don't think I can read some news on it
 
+1
 
@FlorianMargaine jsfiddle.net/wzsxZ
 
thanks a lot :)
heh, it does look way cleaner.
 
haha
 
5:29 PM
btw
something I wondered and don't really know why this or this way
to execute a self anonymous function, at the end, what's the difference between }()) and })()?
I know that crockford recommends }()) but I have no idea why
 
@Florian: there's no functional difference. The brackets only serve to ensure the function is evaluated as an expression, otherwise it would be a syntax error. Crockford recommends a lot of things.
 
0
Q: Ban myself/enforced break userscript

Manishearth(currently under construction) Answer to http://meta.stackoverflow.com/questions/32299/ban-myself-button-in-user-profiles Code and inspiration from Wikipedia's version // ==UserScript== // @include http://*stackoverflow.com/* // @include http://superuser.com/* // @include http://serverfault....

 
If Crockford's so bothered about how it's written, why doesn't he write void function () { }() ?
 
well I do know that crockford's quite opinionated sometimes, which is why I'm asking
10
Q: Is there a difference between (function() {...}()); and (function() {...})();?

Peter Ajtai Possible Duplicate: Location of parenthesis for auto-executing anonymous JavaScript functions? Sometimes I see: (function() { ... }()); and sometimes I see: (function() { ... })(); I see both forms with and without arguments. They both execute the anonymous function. Is there...

hmmm
since jQuery uses })(), I'll use }()) :p
 
They're the same, Crockford recommends wrapping in () so it's clear it's immediately invoked. Whether they're inside or outside is a stylistic preference
 
5:40 PM
Is JSLint complaining about it? If it is, that's pretty sad.
sigh — yes, it does complain about it. That's probably the most pathetic bit of whining I've see JSLint do.
 
0
Q: javascript - would you consider 'prototype' to be the same as 'parent'

junkyI'm learning javascript. I see that with an object, I can use .prototype, is it fair to say that, in a class/tree hierarchy I am effectively using the 'parent' (or 'ancestor' perhaps) by doing that? Can a class only have 1 prototype at a time as in Ruby? Call it Personal Homework that I set my...

 
The only difference is which value is wrapped in parens, really.
(function() {}()) //outer parens wrap returned value from function
(function() {})() //outer parens wrap the function
I fail to see any difference, at all.
 
Crockford argues that the former is more easily identifiable as an immediately invoking function. Personally, I really don't like following } with anything other than ) or ,.
 
6:14 PM
Box2D sucks :(
8megs of garbage per second >_>
oh you horrible flash port...
I'll banish you with some emscripten now
Hooking into destructor calls and adding pooling for JS \o/
 
Can anybody explain why the following doesn't work? var ar =[]; var pusher = ar.push; pusher(["This will not be added"]); console.log(ar);
it baffles me
 
see Assigning Methods
in short, pusher will have window as it's calling context
and not ar
methods assigned to variables do not remember the instance which they belong too
you just get a reference back to the original function with foo = someBla.foo
which is missing the "this" context for invocation
 
user1385191
you can just make a wrapper function
 
user1385191
var pusher = function (ar, add) { ar.push(add); return ar; };
 
also called currying :)
 
6:23 PM
Ah, of course
 
or use ES5's Function.bind() which isn't widely supported though (Safari is still missing it >_>)
 
That also explains why assigning other things like Math.round does work
 
user1385191
I think I'm starting to understand why libraries tend to use call and apply a lot
 
compiling llvm for emscripten takes forever >_>
should have done a make -j ....
 
I didn't really need it, but I was wondering why something like ``
' response.addListener('data', function (chunk) {
body.push(chunk);
});
`
 
6:26 PM
was response.addEvenListener('data', body.push), right?
 
couldn't be shortened to response.addListener('data', body.push)
yeah
 
It's just a shortcoming of the language
In Python for example this would work just fine
because you're actually having a "instance" of the method (which knows it's object) and not just a reference to the function
 
It's weird, but I wouldn't call it a shortcoming
Like dynamic context, it's just misunderstood :P
 
0
Q: Javascript function to return index of nth occurrence of substring: Please review

AGuyCalledGeraldI built a javascript function returning the index of the nth occurrence of a substring in a string. $(document).ready(function() { var containingString = '.this.that.'; subString = '.'; var index = GetIndexOfSubstring(containingString, subString, 2); }); funct...

 
user1385191
oh look; another useless inclusion of $
 
Mac
6:29 PM
why so? On the document.ready?
 
:D
93KB for one $ call is fine
 
user1385191
the code is to manipulate strings
 
Did strip out a lib from my company the other day...
was using like 4 functions of jQuery
but included the whole damn thing >_>
 
user1385191
I'm going to push a big update to Utils today if anyone wants to take a look
 
Mac
Whats so bad about the $ ?
 
user1385191
6:31 PM
you don't need a DOM library to manipulate strings
 
@Mac If you use the $, USE IT ALL or NOTHING.
that's it in a nutshell
 
while ( times <  occurenceNumberOfSubstring && (index = containingString.indexOf(substring, index)) !== -1 ) {
    times++;
}

return index;
 
Mac
ah, ok
 
pulling in 93 Kilobytes, for 200 bytes worth of a function is sad
build faster you emscripten thing you -.-
 
@MattMcDonald raises hand
 
user1385191
6:32 PM
I just have to pretty up the source and hack around with the Makefile
 
@MattMcDonald I've got some time and I need to do some code reading and coding this weekend anyways... to much work only coding lately
 
did only API work for like 3 weeks now >_>
 
Mac
Totally nothing to do with JS, but have you all noticed the new 3D mode in Firefox if you inspect an element :)
if your in the latest Firefox right click in the chat, inspect element, and hit the 3D button :)
It basically gives you a 3D representation of the layers
 
6:50 PM
btw chrome canary is really broken atm
packing a Number into an array can corrupt memory resulting in 1000 becoming 2.25e+104
resulting in some funny behavior in case this int happens to be a game timer...
 
GGG
@FlorianMargaine what bug does that avoid? Changing the -1 to a 0 works for me - jsfiddle.net/njaeD/10
 
turns out the existing box2d emscripten port already does what I want
and oh wonders, the GC profile is a lot more sane on this one :)
 
user1385191
7:11 PM
I need to find a better way of doing this:
 
user1385191
function generateTextSetters()
{
	/*
                Private method that "generates"
                an object with keys of `nodeType`s
                that can "set" text.
	*/
	var setters = {};
	setters[nodeTypes.ELEMENT_NODE] = true;
	setters[nodeTypes.TEXT_NODE] = true;
	setters[nodeTypes.PROCESSING_INSTRUCTION_NODE] = true;
	setters[nodeTypes.COMMENT_NODE] = true;
	setters[nodeTypes.DOCUMENT_FRAGMENT_NODE] = true;
	return setters;
}
 
._.
what even is that
 
GGG
ahahah
@IvoWetzel emscripten inspired me
simulating goto with a while and a switch is just genius
 
@MattMcDonald check it
function generateTextSetters()
{
    /*
                Private method that "generates"
                an object with keys of `nodeType`s
                that can "set" text.
    */
    var setters = {};
    ["ELEMENT_NODE", "TEXT_NODE", "PROCESSING_INSTRUCTION_NODE",
        "COMMENT_NODE", "DOCUMENT_FRAGMENT_NODE"
    ].forEach(function (v) {
        setters[nodeTypes[v]] = true
    })
    return setters;
}
 
GGG
stringy
 
7:16 PM
who was the resident opera-affiliated person ?
 
@gsnedders
 
user1385191
I discovered this yesterday:
 
user1385191
quite cool
 
or you could just develop for the mobile app itself
i tried scaling something to iphone, never works right, just develop in objective-c and deal with the inefficiencies
use the storyboard feature of iphone, you will get it done fast
 
user1385191
7:19 PM
not everyone has an iPhone
 
user1385191
it's kind of an important logical leap you made
 
@rlemon So the question was... r lemons pretty good? ahahaha
 
they actually are, my sister would punish me when i was 5 and make me eat lemons, and because of that, i grew to like them
 
@IvoWetzel it's that always the question?
What do you do when life gives you lemons?
/me? I throw a family reunion
 
GGG
7:21 PM
<rimshot>
 
I actually laughed about this one :D
 
GGG
grrr arrrrgh grr grr
 
last night I saw my mom, she asked, "Rob, Why the sour face?"
 
GGG
i am sick of this stupid query selector
 
user1385191
I'm sick of it and I never use it!
 
GGG
7:23 PM
@MattMcDonald lol
 
I'm sorry guys i'll be hanging around for a little while.
 
GGG
@rlemon you like being a lemon don't you
 
I love being a fruit!
2
looks around
 
GGG
lol
 
ok ok enough of the puns.
so how about that IE?
 
GGG
7:24 PM
what if one day you find out the name was really melon
you'll have to come up with a whole new repertoire
 
Monsieur Citron to the @FlorianMargaine in the room.
disappears for a bit
 
btw: XDomainRequest sucks
 
GGG
yeah how does that work anyway
can i really not make a normal CORS XHR with IE
 
no, you cant
 
GGG
gotta use XDR for real?
fuuu
 
7:27 PM
you have to use a proxy frame
XDR has stupid limitations
like: can't set content-type
no status codes etc.
 
GGG
yeah it didn't seem like it could do a PATCH request
 
it's broken beyond repair ._.
 
GGG
or DELETE
 
hey @IvoWetzel have you ever heart the name "Jason Davidson" floating around at work?
 
You need IE10 and Win 8 for CORS XHR in IE
 
GGG
7:27 PM
awesome
i'll just continue to ignore ie
 
@rlemon Uhhhhh maybe... there are so many people at our US office
 
GGG
not my fault
 
he's supposed to be in Cali but remains working from home in BC.
 
@GGG Opera sucks too, luckly corp has proxy pages in place
so throwing away 40kb wrapper code replacing it with 4 lines and et voila
everything works again
 
GGG
@IvoWetzel yeah i noticed... it seems to just silently drop CORS requests
(opera)
i may have to just proxy everything
 
7:29 PM
it throws some stuff in the Dragonfly console
 
@IvoWetzel I have to ask him more about what he's involved with but I do know they pay him a whole hell of a lot. he's family
 
funny thing:
 
GGG
i might be doing something wrong... i couldn't get github login to work in opera
 
it fails on it's own security restictions when trying to show more infos about the target frame :D
 
GGG
7:29 PM
@IvoWetzel a lot of browsers do that...
chrome does it too
and FF
firefox and ie should just switch their backends to webkit
and their js engines to v8
problem solved
 
not really
then you got another IE
just that it's named Chrome
and MS is now called Google
ok there's Apple... but they're all about iOS
 
GGG
don't forget konqueror ;)
 
how could i!
 
GGG
i think it's actually pretty amazing that "khtml" made it this far
 
well they like to work on it :)
 
7:43 PM
o/
 
GGG
\o
 
user1385191
just discovering vim's registers
 
GGG
alright, i think i have figured out a very efficient algo for selectors
 
Hey there @IvoWetzel: long time no see (my fault)
 
@ircmaxell Haven't been around much either lately :)
How you're doing?
 
GGG
7:47 PM
^ @ircmaxell you should make that your gravatar
 
user1385191
JSLint and I are disagreeing for the first time in a while
 
@IvoWetzel Doing good! And yourself?
 
user1385191
for (key in keys) {
	hasProperty = keys.hasOwnProperty(
		key
	);
	if (hasProperty) {
		getters[key] = true;
	}
}
 
user1385191
= error
 
7:55 PM
@ircmaxell I guess I'm fine, at least on the work side of things. But the weather is getting better over here, so going to the park and other stuffs on weekends might become feasible again
 
:-D
 
GGG
@MattMcDonald you mean the thing where it tells you to use hasOwnProperty
even though you might actually want to get stuff in the prototype =p
> The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.
jslint is dumb
 
@MattMcDonald your code is ugly ;_;
 
GGG
@Raynos it looks like a symptom of reading David Mark code
@Raynos btw here I think you lost these: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
user1385191
it's not dumb
 
user1385191
8:01 PM
it just wants for(a in b) { if (b.hasOwnProperty(a)) { dumb; }}
 
user1385191
but I think function calls in blocks are stupid
 
GGG
uhh...
so where would function calls be made?
just in the global scope?
 
@MattMcDonald Well... Why? You're creating an un-necessary temporary variable, and obfuscating what's happening. So I think your code is actually worse than putting the call inside the if...
 
GGG
 
8:13 PM
@MattMcDonald your still doing a function call in a block
 
user1385191
logic block*
 
you think function calls in expressions are stuipid
if (herpDerp()) { }
@MattMcDonald you should try cobol or fortran
I think it would suit you
 
user1385191
the other problem is that they tend to beget long lines
 
thats a different issue
I sometimes do
 
user1385191
if (condition && functionCallHere(abc))
 
8:15 PM
if (condition &&
    condition2 &&
    condition3
) {

}
 
GGG
hey better yet
condition && condition2 && condition3
 && noBlocksHere();
 
meh
that could work
but thats just turning every block into a function :\
 
@GGG There is no real advantage.
 
8:32 PM
there is the disadvantage of performance ;)
 
0
Q: Can't access SimplePress forum toolbox in IE

AndyI think this is a very strange problem and I'm not sure that this is the correct stackexchange website to use, however I'm still hoping that somebody here will be able to help me. Basically, when a user has the correct permissions, hovering over the topic icons will bring up a little toolbox ico...

 
user1385191
2814 loc
 
user1385191
passes jslint
 
Feels good using ES5 stuff and just with Node
 
user1385191
8:43 PM
what are the options to minify js again?
 
user1385191
YUI compressor,…
 
uglifyjs is another option.
 
GGG
google closure compiler
with advanced optimizations
hands down
it has dead code removal and stuff so it's good for modular stuff that gets included into one file before minifying
 
uglify for personal needs
I have an enhanced version which minifies _underscorePrefixedVarsAndMembers
at work we use github.com/zynga/jasy
full blown dependency / asset / optimizing / doc tool
but I would not recommend it on small scale it would be overkill :D
 
user1385191
I don't know if including a 5 MB jar in the repo (closure compiler) is a great idea
 
8:51 PM
Put some beans into the Jar ahahahaha
at somepoint we might even add a jshint like thing to jasy
 
GGG
@MattMcDonald submodule it
there's a git mirror
or have your thing work with multiple minifiers :)
 
create a makefile
tell people to install uglify via npm
all done
 
GGG
yeah that would work
 
user1385191
pretty much what I think I'm going to do
 
GGG
does uglify do dead code removal and stuff though
 
user1385191
8:54 PM
(aside from recommending a compiler)
 
@GGG Well, it removes code that's obviously dead
but without parsing the project as a whole you never know what's really dead
 
0
Q: How can I clear explosions in my function?

hustlerincHi I have a function to place bombs, and a for loop that places explosions on the tiles where possible. My problem is that I can't remove the explosions after a while. I've tried everything I can come up with so now I turn here as a last resort. The function looks like this: function Bomb(){ v...

 
jasy for example actually does that and excludes stuff from builds
 
GGG
@IvoWetzel Closure does a preetty good job of it
 
but then again its focus lies on huge projects (40+ classes, maybe a dozen deps)
@GGG I'm not a huge fan of Closure, too much config needed
 
GGG
8:56 PM
like if you have some modules you require internally and you don't call all of the functions in them, they'll get chopped out if they're not publicly exposed
config?
you mean like externs and crap
 
yes
 
GGG
and something["public"] = lol
i don't use any of that crap
everything is just compiled, nothing is public
 
I see
 
GGG
minified size is very small
 
9:19 PM
Looks like I'll have to wait until the morning to see if my NAS has finished compiling node :-\ Stupid thing, I really need to upgrade to something with a better processor.
 
Mac
9:36 PM
How in the world are they doing this on their mobile site - m.extremetech.com (You will have to fake your user agent to an ipad to see the effect because they redirect otherwise.) I see that as your scroll/drag the area it increases the
-webkit-transform: translate3d(0px, 0px, 0px);
value, but how exactly are they increasing this value, via the touchmove events?
 
user1385191
hooray for server-side UA sniffing!
 
Mac
lol
 
 
2 hours later…
11:26 PM
Wow. Never use .filter to get the first element.
Um... never use .filter at all! On Chrome Canary at least.
Okay, balances out on IE10. Still...
 

« first day (524 days earlier)      last day (4424 days later) »