« first day (352 days earlier)      last day (4598 days later) » 
00:00 - 15:0015:00 - 22:00

3:05 PM
Just remember bubbling and propagation, all events bubble unless you say not to, and all events propagate, unless you tell them not to
that's what the "return false" does, is it stops bubbles and propagations.
Minus some edge cases of event defaults
 
Yeah, that problem's really what I'm after.
And wtf is this new $().on and .off feature?
Did they put something in that stops people from bubbling?
 
It's to get all events in 1 stack
you have .live, .bind, .whatever, there's like 4 stacks now
 
0
Q: Jquery not working

Toni Michel Caubet(function($) { $(document).ready(function(){ /*$('body').css('position','relative'); $('body').animate({'left':'-9999px'},3000);*/ alert('hello'); }); }(jQuery)); Tried also $(document).ready(function(){ /*$('body').css('position','relative'); ...

 
More cowbell!
 
lol. Cowbell is not working! Hit it harder!
 
3:17 PM
and you need only one
 
I forgot how terrifying Perl can be. Guess what this does:
while (<>) {
  split;
  print $_[1], "\n";
}
 
What's <> do?
Stdin?
I'd imagine that prints each new character typed to a new line.
 
Who can possibly guess that it reads a file line by line, and reads the second value after a whitespace?
So that Johnny Bloom\nOm nom should output Bloom\nnom
How did things get to $_? Well, when you just do split, things magically appear in $_. It's a giant mess
 
$_ and $[0-9]+ are perl voodoo.
Part of how regex got into the lovely mess it is.
Matching for a (a(b)), $1 is a, $2 is b.
$_ contains $1 and $2.
Not that you have a hope in hell of searching google for what the name of this feature is.
I wrote an entire POP mail client in about 20 lines of perl once.
open socket, send text, do crazy regex, rinse&repeat.
 
It's super annoying that %voodoo and @voodoo and $voodoo are completely unrelated. Each data type has its own "namespace".
 
3:31 PM
$a = stream;
@a[<>] ~= /wtf/"derp"/
 
It gets worse. $voodoo[0] may actually refer to @voodoo!
 
No, they're related. You just mutate it at-will.
 
Why do people USE perl?!
 
Into some hideous beast.
@JustinLong Ever stare into the abyss?
 
I think it's addictive
 
3:32 PM
@Zirak When you realize you can write a whole program in one line, it kinda is.
 
It's a language that allows, no, tells you to write code in the way you always wanted to. Giant spaghetti soup. It's super tempting
It's programmer heroin
 
I just can't stand the "there's more than one way to do anything herp derp"
 
function (derp) { return derp.dederp; } === (derp)->{ return derp.dederp; } comes to mind.
 
@JustinLong This is true for everything in life.
gist: My Y-Combinator example, 2011-09-29 18:42:08Z
/*
First group takes a function and returns a 
function that calls a function with an 
argument
*/
(function (ycomb) {
    return (function(n){
        return ycomb(ycomb)(n);
    });
/*
Second group is the function passed to the 
recursive combinator. 
*/
})(function (self) {

/*
This is the part that you're working with
that becomes your recursive function.
*/
    return function (x) {
        if ( x > 0 ) {
            console.log(x);
/*
It's really important that the value you 
return is a function that calls it's self
that passes the next set of arguments
*/
            return self(self)(x-1);
        }
    };
/*
And this is your input value
*/
})(5);


/*
Notes: You could always abstract away
most of the ceremony for this, should
you ever need to use a y-combinator I
would advise you do so.

Uses: Really, the only time you're going 
to use this is when you're programming
a function that is anonymous and you 
cannot expose any variables to a higher
scope.

Warning: Most people will never encounter
this in JavaScript. Also, beware that
Internet Explorer 6, 7, 8 all run 
"JScript" not JavaScript, and it will
hoist all variables to the global
namespace. This is resolved with IE9.

*/

 
I never understood Y-Combinator
 
3:44 PM
Oh shoot, I said variables in the last note where I should have said functions.
My example walks you through it.
It's just a function that makes another function recursive.
 
I still don't get it.
 
Okay, normally you can't do function x() {x();}.
If X is nameless.
so, how do you call function(){Uhuo();} ?
 
Ci
 
You pass function(){whatever} into a function that makes it call it's self.
That's what this is:
 
aah, nice
 
3:47 PM
function (ycomb) {
    return (function(n){
        return ycomb(ycomb)(n);
    });
 }(Whatever)
But whatever is going to be whatever(whatever)(parameter)
That way, it calls it's self to do the recursion, but also passes the parameter.
 
oh, I think I get it. The inner function runs itself only while the called function returns itself
 
so now you can do y(function(x){ return x-1})(5);
Right. It's recursion without a reference to it's self. It needs to return a bunch of functions to do that.
 
Pretty awesome!
 
In other languages you can't call a function unless it's already defined, so func x(){x()} will throw a run-time-error, perhaps a compiler warning or error.
So y-combinator is important there.
But in most modern languages there's no issue.
 
@Zirak LOVE IT
I've been meaning to read The Little LISPer for a while. Haven't gotten around to it, though.
Mostly because I just haven't purchased it
 
0
Q: Adding a class (arrows) to main menu links that have children?

WordpressorI'm wondering if it is possible to add different classes to second/third/fourth/etc-level items that have children in Appearance > Menus tree? That's how I call the menu: <?php $menu_args = array( 'container' => '', 'menu_class' => '', 'menu_id' => ...

 
4:46 PM
Does anybody else ever have those moments where you think "There's got to be a better way to do this, but I just need to get it done, so fsck it."?
 
No. My boss etc understand that good code is worth the wait.
 
@JustinLong Lucky bastard ;-)
I'm not sure my boss knows what good code looks like ;-)
(I say as he walks by my cube...)
 
my head hurts some idiot keeps posting useless comments on my thread and I cant downvote because its not an answer but a comment so I jus reported it...
and now he downvoted me
does this look fishy?
$.ajax({
'url': 'http://host.com/action/',
'otherSettings': 'othervalues',
'beforeSend': function(xhr) {
xhr.setRequestHeader("Authentication", "Basic " + encodeBase64(username + ":" + password) //May need to use "Authorization" instead
},
sucess: function(result) {
alert('done');
}
});
 
>< why is he base64 encoding it?
 
wow, batteries are expensive. 6 GP Recycko, AA, $33
 
user1385191
5:00 PM
I've asked this question before, and I'll ask it again:
 
user1385191
how would I go about caching a "live" property (number)?
 
@Nadal , need more information
but this kinda looks like an really bad idea
 
@MattMcDonald Clone it
 
the REST api I am trying to use requires this base64 encode
I can either manually login to a specific site
 
Make a new variable, go over the thing you want to clone and assign all its properties to the new variable
 
5:01 PM
or I can do basic authentication through REST
"Use HTTP basic authentication (Authorisation HTTP header) containing 'Basic username:password'. Please note however, username:password must be base64 encoded. The URL must also contain the 'os_authType=basic' query parameter."
 
user1385191
I just need to cache foo.width
 
read the documentation then , @Nadal
 
user1385191
flash makes it "live"
 
@tereško I have the JQuery and JS code but I am not familiar with this REST JQuery process....confused..
 
this has nothing t do with jquery
you need to know what exactly the remote API expects from you
 
5:04 PM
5
A: Using javascript with the twitter API

bendeweyThere are a few Base64 Encoding tools out there. You can use one of them. You can add a header with the encoded username and password based on the Basic Auth specs Here is a post that does exactly what you want. http://www.aswinanand.com/blog/2009/01/http-basic-authentication-using-ajax/. The...

Hes got something similar so I am trying to do what he has
 
5:20 PM
@Nadal jQuery's .ajax has a built in basic authentication parameter.
 
@RyanKinal Neither does mine.
 
> If the server performs HTTP authentication before providing a response, the user name and password pair can be sent via the username and password options.
=/ not sure why they would encode the whole string however..
 
I wish there was a bed to nap on near me....
 
https://developer.mozilla.org/en/DOM/XMLHttpRequest#open()

`xhr.open( type, url, async, username, password );`
 
@Incognito giving that a try
 
5:29 PM
"Functional thinking: Thinking functionally, Part 1": ibm.com/developerworks/java/library/j-ft1
 
I was surprised there was such a difference
 
@rlemon Holy crap. That's... ridiculous.
 
user1385191
you do realize you only need to do .slice(-1), right?
 
user1385191
substr's crap though, slice is far more robust
 
for the purpose of removing the last character from a string I will be happy using substr. I just did not expect that big of a difference.
and no I did not know about slice() thankyou
 
user1385191
5:47 PM
COMPREHENSIVE JAVASCRIPT FAQ: fortybelow.ca/hosted/comp-lang-javascript/faq
4
 
@MattMcDonald IIRC, this was already posted & sticky-starred by Raynos
 
jsperf.com/substr-vs-slice2/2 < removed variable declaration and dom manipulation
Results are astoundingly clearer.
 
user1385191
@Zirak the pin only lasts so long
 
user1385191
there's something on substr
 
5:52 PM
@MattMcDonald http://jsfiddle.net/rlemon/vf7HA/
turns out I did need slice(0, -1)
I don't want to know what the last character is, I want to remove it.
 
user1385191
that's my error
 
user1385191
forgot leading negatives worked in reverse order
 
user1385191
ie: slice(-3) returns the last 3 chars
 
http://jsfiddle.net/rlemon/vf7HA/1/

I thought you could use substr to remove the last character like substr(0, -1)
or do I need to do substr(0, str.length-1)
 
user1385191
you don't "remove" from strings
 
user1385191
5:55 PM
they're immutable
 
user1385191
string functions return copies
 
Now you're being pedantic. you know what I meant.
I want to remove it [from the return value]
better?
 
Substr was fastest for me...
 
ok so str.substr(0,-1) returns nothing. You have to do str.substr(0, str.length-1);
However with that said it still runs faster than str.substring(0, str.length-1); odd
The difference between the sub[str/string] is nominal tho.
 
6:12 PM
 
Hehe... just got a very positive error message: Uncaught ReferencError: failure is not defined
2
Also, very ironic
 
lol
 
6:35 PM
We could make something animate, in theory. Like it's the 90s again!
 
DNS
I've got a bit of an opinion question that I don't think makes sense as a real question on SO. In terms of code clarity, in a function, is it better to use a full reference to a property, i.e. z = this.a.b.<whatever>; two or more times, or to cache the common portion in a local variable, i.e. var temp = this.a.b; z = temp.<whatever>;?
 
Hi, what do you think , which one is the best framework in PHP & jQuery ?
 
@DNS If performance is a serious constraint then go for it, just name the variable something that makes sense. Another consideration is making sure the prototype isn't lost if you're doing something interesting with objects.
@Tareq cowbell.
 
@cowbell have u anything to tell me?
 
DNS
@Incognito I've been doing it that way for a while, but in thinking about ways to improve my code in a general sense, I began to wonder whether I'd been optimizing prematurely. Performance matters a lot less in most of my code than clarity. On the one hand, caching results in shorter lines, which are easier to read. On the other hand, you then have to scroll up to know what a variable actually does.
 
6:44 PM
@DNS How did you name your vars? Why are they confusing?
 
resurrection
 
@jAndy Psshhh! Back to your grave little zombie!
 
too late, I'm out of it :p
it happened to be that I am in charge of a diablo3 beta account for a few weeks
 
> You are in an open field west of a big white house with a boarded
front door.
 
thats for my excuse :p
 
DNS
6:48 PM
@Incognito They're not really confusing, just potentially less clear. For example, let's say I have an object with a 'visible' property that I read a few times. If I cache it in a local called 'visible', and the function is longer than about 50 lines, it's no longer immediately clear that it comes from that object; maybe it refers to the visibility of some other thing that I'm dealing with in that function.
I'm trying to think from the point of view of the next guy who reads my code. Which would you rather see?
 
@DNS That's what I mean, why would you name it visible ?
And why is it faster to access Bar than it is foo.bar ?
Probably almost the same in computation time.
 
DNS
@Incognito I could call it something like myObjectVisible, but then I get back to longer lines, particularly if it goes more than a single level.
 
@DNS Give me an example of a long line.
 
omg - I'm afraid my social life is highly in danger. If the pretty short beta knocks me out for couple of weeks, imagine what the final release will do to me - Help!
just glad I'm having like 35 free days over
 
@jAndy Start a rumor on a dating site you're totally rich.
 
6:55 PM
@Incognito: lewls
 
DNS
@Incognito Let's say something like this: this.dateRange.datechooser("limits", this.options.limits.min, this.options.limits.max); That's already 88 chars long without any indentation. What I'm trying to get a sense of is whether it's clearer to leave it like that, or to cache this.options.limits in a local called, i.e. limits, and then just use limits.min, limits.max.
 
On the ground is a pile of leaves.
>count leaves
There are 69,105 leaves here.
@DNS Can you not abstract that function to take this.options and call on it's limits.min and limits.max?
Thus, this.dateRange.datechooser("limits", this.options);
    //Alternatively,

    this.dateRange.datechooser(
        "limits",
        this.options.limits.min,
        this.options.limits.max
    );
Is also readable.
 
DNS
@Incognito Pretend that function is not under my control. I'm not trying to solve a specific problem here, just determine which is better for clarity.
 
function DateLimitSelector(options){
    return this.dateRange.datechooser(
        "limits",
        options.limits.min,
        options.limits.max
    );
}
Then you just, DateLimitSelector(this.options)
 
DNS
@Incognito So you'd say that it's clearer to read when broken onto several lines than cached in a local?
 
7:01 PM
Probably, I'd avoid the long chain if you could ideally.
optionsMaxLimit
this.options.limits.min

^ You don't save a whole lot.
 
DNS
@Incognito Thanks; that's the kind of input I'm looking for. Does anyone else have any thoughts?
 
I normally break it up into multiple lines, if you do this a lot I'd make the function I posted above.
 
DNS
@Incognito Exactly; what's why in order to save line space, you really have to call it something short, like 'limits', and at that point it's potentially confusing as to where it came from.
 
DateLimitSelector(options) is more readable than this.dateRange.datechooser("limits", this.options.limits.min, this.options.limits.max); or the multi-line example.
You likely have a grander use for re-mapping around that.
ie, you can reduce the repetitive lines of code by making functions like that.
You're probably doing the same small task a few times.
 
going back to my grave now - I'll be back :-)
 
7:07 PM
@Incognito the answer is...
 
>Go West
 
WITH!!!!
with (this.options.limits) { this.dateRange.dateChooser("limits", min, max); }
 
@david You are in a forest, with trees in all directions around you.
 
Also, if you have constants that are static, capitalize them.
this.options.limits.MAX / MIN
 
damnit, i went the wrong way, was trying to go to the house
>count trees
 
7:09 PM
@JustinLong v.v that's not ......... you best be trollin me.
 
hey see... bitbucket now has git support
 
@Incognito There are some good uses of with, that is not one of them.
 
was just talking with a few guys about that at jsconf
 
@david There are 69,105 trees here
 
I just learned something new about the number 69105
 
DNS
7:16 PM
@IvoWetzel jqconf?
 
js
jsconf eu to be exact
 
@IvoWetzel jealous
 
7:33 PM
Wow, I didn't realize people still put these on sites.
 
@Incognito Only people who don't know what they're doing.
 
soooo many node.js fibonacci generators popping up
no automatic prettying of github links?! shocking
 
@david Ahahaha :)
 
7:49 PM
What's the point of var findFaviconTag = function findFaviconTag...?
The second findFaviconTag is useless
 
No it's not.
Imagine you're in a closure.
If you called out of the closure, you'd get a RefError
Also, it gives you names in debug stacks
 
You'd get the same thing with just the declaration, or without the name at all.
Still be a RefError, since both are function expressions
(function() { var see = function see() {}; })(); try { see(); } catch(e) { console.log("See?"); }
 
But Function names hoist.
WURKS IN IE HERP DERP
 
Closures create a new scope.
 
I think the second name helps with debugging
 
7:53 PM
Fuck IE, I'm talking about real browsers.
4
 
IE hoists function names to the global scope unless over-riding later.
IE is a real browser
Also the largest share.
IE9 actually waits until feature completion
THE HORROR
 
China has the largest population, doesn't mean it has a real economy.
 
O_O
 
IE 8 still doesn't conform completely to the standards, hoisting to the global scope is a bug
 
@Zirak Can I +1 this?
 
7:56 PM
@rlemon Do as you wish :P
 
@Zirak ... surely you jest, China has an amazing economy now
"China in 2010 stood as the second-largest economy in the world after the US, having surpassed Japan in 2001."
 
Because a country is rich doesn't mean it has a strong economy (strong !== large.) But this isn't the right place to argue about this :P
 
IIRC 3 didn't have that spec'd
Not spec'd != a bug
 
Anyway @JustinLong, in a browser that's actually implemented js decently, it will not hoist to the global object.
 
@Zirak, and Justin, China from 2000 to 2010 was the #2 rank for *** Incremental GDP ***, this doesn't mean they are the second largest economy.
 
7:59 PM
o rly?
 
I'll say this about China: The average Chang there is very poor, the average Chang makes about 70% of the population. When they'll realize they can earn more, the Chinese economy will lost millions from its work force
Waiting for it to load...It's under Function Declaration, can't remember the exact wording
 
NOTE
The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody
to allow the function to call itself recursively. However, unlike in a FunctionDeclaration, the Identifier in a
FunctionExpression cannot be referenced from and does not affect the scope enclosing the
FunctionExpression.
if the enclosing is not global
then it is not spec'd
 
That's just a note. I know that it can be used that way, but it doesn't speak about the hoisting
@rlemon LOL
 
8:05 PM
world leader in gross value of industrial output; mining and ore processing, iron, steel, aluminum, and other metals, coal; machine building; armaments; textiles and apparel; petroleum; cement; chemicals; fertilizers; consumer products, including footwear, toys, and electronics; food processing; transportation equipment, including automobiles, rail cars and locomotives, ships, and aircraft; telecommunications equipment, commercial space launch vehicles, satellites
 
New wallpaper
 
weird.
The word "hoist" is never in 3rd version
 
Hoist isn't the official term, dunno the real term
 
found that through a quick "bing"
 
@Zirak possibly are you looking for; elevate, erect, heave, pick up, raise, rear, take up, uphold, uplift, upraise, or uprear ?
 
8:11 PM
This room is NOT about china talk
 
For each FunctionDeclaration in the code, in source text order, create a property of the variable
object whose name is the Identifier in the FunctionDeclaration, whose value is the result returned by
creating a Function object as described in 13, and whose attributes are determined by the type of
code. If the variable object already has a property with this name, replace its value and attributes.
Semantically, this step must follow the creation of FormalParameterList properties.
So it is independent of scoping according to ver 3
10.1.3 if you were wondering
also, does anyone use Function as a constructor?
 
I can't seem to find the part about how to handle variables/declarations in a scope...
 
That's 10.1.4
However, FunctionDeclaration is never declared to be global or local scoping.
The difference is if FunctionDeclarations are made at parse or runtime
 
FunctionDeclaration is hoisted to the top of the scope, after the variable declaration.
 
if it's made at parse, it should go to global scope, since you can't make scopes yet
if it's at runtime, then it should be made in the local scope
 
8:15 PM
Erm, no.
When you make a self-executing function function something() {}(), then it is bound to the global scope. However, it creates a scope of its own
Everything in it isn't, shouldn't, be added to the global object, since it's inside a lexical scope of the function.
 
so, you're saying
(function s1() { function s2() {} })()
s2 shouldn't be made in the global scope, but should be only in the s1 calling scope?
 
Yep
Each function has its own scope
 
Hello
 
@HanletEscaño Hey there
@Zirak What section?
 
It's LEXICAL SCOPING
 
8:21 PM
Give me the section number.
 
Each function has it's own scope, period.
 
I've given you all of mine.
 
My interwebz is slow, 5 secs
13.2
Point 7 says "Set the [[Scope]] property of F to a new scope chain (10.1.4) that contains the same objects as Scope"
 
jQuery team working on strategies to make jQuery faster http://twitpic.com/6upmmf
 
22
Q: What is lexical scope?

Subba RaoI want a brief intro to lexical scope

Perl, methinks, has a way to do both (static/lexical declaration and dynamic declaration.)
 
8:31 PM
dynamic scope would blow my mind
 
8:41 PM
hahaha, I just realized I posted the wrong one.. That was supposed to be "Dynamic Scope"
 
i was so confused ><
what does DKLA stand for?
 
royal wedding.
 
but literally?
dame kate lord andrew? that's the only semi-logical thing i can think of
 
9:04 PM
Don & Kaycee Laroza
 
00:00 - 15:0015:00 - 22:00

« first day (352 days earlier)      last day (4598 days later) »