« first day (404 days earlier)      last day (4527 days later) » 

12:06 AM
@david I thought it was useful
I refactored it so much the switch statement is now silly
 
why didn;'t you just copy the underscore after function?
 
Because my one passes paramters to the after funciton
underscores after function doesnt pass parameters along
var cb = after(2, function (a, b) { alert(a + b); });
cb(2);
cb(5);
@david as for "alternatives" I promote use after & stak
 
@Raynos App fog's neat, but I never found it useful.
 
@Incognito do you have one of their beta accounts?
 
Hey, I'm looking for a real simple function to convert numbers like "1" in to "1st" and "2" in to "2nd" .. im sure i could write something but it would take and age.
 
12:10 AM
@Raynos Yeah, for a long time.
 
ahh i see, so it's almost doing partial application too :S
 
@Incognito once my blog is done being refactored you can trivially launch a clone of it using app fog
 
Sweet!
 
@david yes something like that
@Wezly
 
yo
 
12:12 AM
function convert_it(it) {
  if (it === "1") {
    return "1st";
  } else if (it === "2") {
    return "2nd";
  } else if (it === yourmom) {
    return "oh yeah";
  }
}
Done o/
 
what about 4 :P
 
rofl, google wave sends me an email about they're discontinuation, as if anyone actually is using it right now anyway.
 
@ChadScira what about your mom
 
lol
 
i don't think you are getting me. :) I'd like to insert a number and get the right extention
like 1 would return 1st but 11 would return 11th .. get me?
 
12:12 AM
basically he doesnt want to use google
or write code
 
@Wezly I'm trolling
 
ive been writing code all day. just thought this must have been done.. :D
 
@Incognito I am :( i need to export
 
@Wezly , this sounds awfully like a homework , something what teacher would give you after he/she/it explained how reminders work
 
ha. I'm sorry its so simple i just can't think what to google.. what do you call those little bits on the end?
 
12:15 AM
@Wezly Did you try to google for number ordinals?
 
;)
 
function addSuffix(d) {
d = String(d);
return d + (d.substr(-(Math.min(d.length, 2))) > 3 && d.substr(-(Math.min(d.length, 2))) < 21 ? "th" : ["th", "st", "nd", "rd", "th"][Math.min(Number(d)%10, 4)]);
}
i always forget how to do code blocks in the chat
whats the secret?
 
0
Q: How to retrieve the value of a shadowed global variable?

Šime VidasExample: var test = 'global value'; (function() { var test = 'local value'; // how to get the 'global value' string })(); Given the condition that the host environment is unknown, meaning that we cannot assume that the global object will be accessible via the window name. Also, the f...

 
@ChadScira Sacrifice a thistle to cuthulu
No, just clicked fixed-font.
 
lol
 
12:17 AM
@ChadScira ta v. much will give it a test. it's not homework teresko you dawwg
 
@ŠimeVidas Is this trolling? You want a value that might not exist?
 
@ChadScira works like a treat. thanks. :D
 
@Incognito It's a theoretical question. My motivation for asking is to learn how this can be done...
 
peace.
 
@ŠimeVidas not possible
There are two hacks you can try
 
12:20 AM
fixed font!?
 
this.globalName and delete local_var
Neither of them work in ES5 strict
 
I don't think delete local_var would do it either.
 
@Incognito it does in broken implementations
 
Ah.
 
@ŠimeVidas is global eval a valid solution?
 
12:26 AM
@Raynos It is possible in ES5 strict ;).. I know a hack hehe
@Raynos Well, yes that too....
@Raynos I used the Function constructor... I guess that could be considered global eval too...
var test = 'global';

(function () {
    'use strict';

    var test = 'local';

    var desired_value = ( new Function( 'return test;' ) )();
    console.log( desired_value );
})();
 
now make it work with this:
(function (){
    var test = 'global';
    (function () {
        'use strict';
        var test = 'local';
        var desired_value = ( new Function( 'return test;' ) )();
        console.log( desired_value );
    })();
}())
 
@ŠimeVidas thats the work around I was looking for
 
0
Q: Why Javascript is used in MongoDB or CouchDB instead of other languages such as Java, C++?

startup007I asked this question on SO but was suggested to try here. So here it goes: My understanding of the Javascript so far has been that it is a client-side language that capture events and makes a web-page dynamic. But on reading the comparison between MongoDB, and CouchDB (http://www.mongodb.org/d...

 
@david I think that truly is impossible. Accessing the global environment is possible with global eval, but accessing the outer environment?
 
yeah, accessing the shadowed var
i should hope it's impossible :S
 
12:45 AM
@david Impossible except in old versions of SpiderMonkey (through __scope__)
@ŠimeVidas Given an answer that works in es5-strict and doesn't rely upon eval'ing the var name, FWIW
 
@gsnedders can we do it without eval?
 
@Raynos Not entirely. You have to get the global object from something that is evaluated (unless you save a reference in the global scope, à la var global = this;), but then you can just do a property access on it.
 
1:31 AM
something is seriously bad with latest SO update
 
The new user profile?
 
no , the profile works just fine
but the landing page has a habit of not finishing the loading
oh god ! i looked at SO's html code ... bad case of divitis
 
You mean the homepage doesn't stop loading and the DOMReady event isn't called even after everything appear to have finished loading?
@tereško Yeah... I would recommand you not to read SO's HTML source
 
it gets stuck downloading external stuff
 
I've done a bit of tinkering, did you know that SO uses tables for layout?
 
1:34 AM
@tereško its been doing that for ever
@tereško of course it has bad markup, it uses .NET o/
 
usually from google or the career domains
 
hmm
 
I get a 10 seconds lag because of that HTTP request to a tracker
Hmmm, there are already 26 questions on SO
There's also inline JavaScript events, a lot of them. Just... don't read SO's source code if you don't want to rage
 
yeah , there are already enough things to rage about
 
1:40 AM
Regular public service announcement:
Please update the tag wiki regularly with new information and resources. Thank you.
5
 
ehh ..
1
Q: Jquery toggle div hide/show from dynamic id's

adamI have, essentially, an unlimited number of containers with dynamic ids and a dynamic menu to load each containers content. I have done this with static id's (but still seems such a heavy use) but do not know where to go to use dynamic. When a nav link (from .img_select) is clicked it shows the ...

the final comment :
> thankyou for your time to help. As Jquery was the topic I am looking or an idea that utilises jquery.
 
@tereško o_o at the code
 
@tereško trolls be trolls
I downvoted him for you
 
I mean, ignoring the jQuery (which is unnecessary, yes) does he understand the concept of loops at all?
 
1:44 AM
naah .. no point
@YiJiang , FYI , that is how most of jquery programmers code
 
hmm
anyone have experience with stylesheet injection?
 
Why?
It's just a simple case of use CSSOM
 
well im writing a stylesheet via javascript but it takes a while for the DOM to actually apply it
i need to figure out when its ready
i dont want to have to use timers
 
@YiJiang Guidelines on wiki content?
We could just as easily dump the whole internet in there
 
@ChadScira it should be blocking, you create the stylesheet then inject
 
1:53 AM
@Incognito Read the sidebar, keep it short, don't duplicate when you can link to something
 
I presume what's actually "taking a while" is any images / resources loaded in the stylesheet
 
its not blocking
 
Other then that the re-rendering reflow should be near instant
 
there is a noticeable lag
 
fiddle it
 
1:54 AM
100ms
ok so im injecting all the html after
its not already on the page
 
13
Q: Tag Wiki best practices

Walter MittyThe tag database-design has no tag wiki, and SO invites me to help create one. I've got the reputation. I think Database-design really needs a tag wiki. I'd like to help. But I don't feel quite up to creating a tag wiki on my own for three reasons. First, I'm not too sure what a good tag wik...

 
@ChadScira gtmetrix.com
 
why do i get the feeling that @ChadScira is trying to do something ill-advised ?
 
psh...
i will be releasing this
 
@ChadScira That's what the guy with a vial of anthrax said.
 
1:57 AM
hehe
hopefully its just as lethal
basically im taking another angle at CSS
 
hahaha
 
@ChadScira You've seen sass, right?
 
yep
still dont like it
i have tried them all
 
stackoverflow.com/revisions/8251315/2 this for some reason amuses me
 
2:00 AM
and i dont understand why we need to compile...
we have JS...
 
@ChadScira ... CSS is static
a DSL on top of it is useful
 
@ChadScira Sorry that doesn't have any context, what do you mean compile?
 
and I compile JS, it's called minifying/packaging
 
thats fine
 
@Raynos Is that really compiling it?
 
2:01 AM
wait for me to finish this then criticize it
no its not... you know what i meant
you can keep your static css... i want to be able to have code in mine
 
@Raynos packers are kinda harmful and counterproductive
 
and i want to be able to minify and pack my CSS
 
@YiJiang I like lunch bitches
@tereško depends on what we mean by the word package
@Incognito I'm using a machine to compile from one format to another format
 
I dont mean that one
 
2:03 AM
yep... i use that
 
I mean using a compiler to bundle and package dependencies
 
@ChadScira you shouldnt
 
I have a bunch of blocking require("some_lib") calls and I use a compiler to preload and package them
What's the correct word for that technique?
 
/**
* runs a string through dean edwards javascript packer
*
* @param {String} string
* @param {Function} callback
*/
function pack (string, callback) {
var path = '/tmp/node-' + Math.random();
fs.writeFile(path, string, function(err) {
if(err) {
console.log(err);
} else {
var buffer = '',
compiler = spawn('perl', [
'-I', './executables/JSPacker/',
'./executables/JSPacker/jsPacker.pl',
// packer opts
'-q',
'-e62',
'-f',
'-i', path
]);

compiler.stderr.on('data', function (data) {
console.log('stderr: ' + data);
 
@tereško in goes foo out comes eval(function(p,a,c,k,e,r){e=String;if(!''.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('0;',2,1,'foo'.split('|'),0,{})) ... I love it.
 
2:04 AM
im loving node
 
@ChadScira don't do that :( use uglify
 
@Incognito as i said .. harmful and counterproductive
 
why is uglify better?
i want the highest compression
 
that's what zlib is for
 
@ChadScira incorrect, you want the highest safest compression
 
2:05 AM
@ChadScira Odin save us.
 
The way to do that is uglify and zlib
var modul8 = require("modul8"),
	fs = require("fs");

function build() {
	try {
		modul8("./test/test-suites/main.js")
			.compile("./test/tests.js");

		modul8("./src/main.js")
			.compile("./lib/DOM-shim.js");
	} catch (e) {
		console.log("compiler error", e);
	}
}

build();
 
i want both
 
I also recommend you use modul8
@ChadScira packer isn't safe.
 
how?
its all on my server
 
Because it's not a 1-1 translation
 
2:06 AM
 
@ChadScira wait are you packing node.js code? If you are I punch you in throat
 
no
haha
that would be awesome
 
rofl
 
@ChadScira the point is, don't trust the code packer outputs
 
2:07 AM
i havent had many issues
when that happens ill stop
 
how about fact that it makes you JS slower ?
 
thats fine
 
@ChadScira ...
 
then why do you minify it in the first place ?
 
less bandwidth
filesize
 
2:08 AM
@ChadScira Actually, if you take into account gzip, not using the base64 packing option would be better
 
is it really?
 
am i only one who has noticed the cognitive dissonance in his statements ?
 
i havent ran those tests
 
@ChadScira are you using jquery for that CSS solution of yours ?
 
@Matt @Andres you realise the correct way to have private conversations is in your own rooms right ;)
 
2:10 AM
@tereško No.
 
no i am not
 
oh really
 
colour me surprised
 
I'll check that out
 
@Raynos didn't know first time using chat
 
2:11 AM
@Raynos I second this. @Matt @Andres If you're discussing a specific question, please create a new room and move there
 
@tereško you guys are really funny...
@tereško im trying to make the most optimal way of content delivery
if you wan to see a sample
here is an example
this is my public test so far
 
@Andres alright here it is: chat.stackoverflow.com/rooms/5294/andres
 
7 messages moved to @Andres
 
fuck
 
like GWT , only worse
 
2:15 AM
lol
 
room topic changed to JavaScript: Discussion for JavaScript and the many frameworks - jQuery, Prototype, MooTools, et al. [javascript] [jawesome] [jquery] [mootools] [nyan] [prototypejs]
I'm not sure which *cough cough* moron added that bit in
 
needs more cowbell.
 
@ChadScira you really want to not use packer ;) use uglify
@YiJiang :( It wasn't my idea
room topic changed to JavaScript: Discussion for JavaScript and the many frameworks - jQuery, Prototype, MooTools, et al. [cowbell] [javascript] [jawesome] [jquery] [mootools] [nyan] [prototypejs]
@YiJiang what's your problem with us promoting the non-use of mediocre frameworks :\
 
@Raynos uglify doesn't use eval right?
 
Of course not
using eval is stupid
 
2:26 AM
:P
 
That's like saying "uglify doesn't use jQuery right?"
 
lol
ill switch if it in conjunction with gzip gives me better results than deans eval/evil packer
personally i dont really care about a 30-100 more MS spent on eval
 
@Raynos you can critisize other frameworks when you write one that has as many ninja moves as jQuery
 
RT @__DavidFlanagan: Yay! I got dom.js working (mostly) with Node. Great way to start a long weekend! https://github.com/andreasgal/dom.js
 
@Matt I am writing one. I'm writing a bunch
 
2:30 AM
cool. can I see?
I bet it doesn't use innerHTML am I right?
 
isnt innerHTML faster?
 
@Matt o/
@ChadScira trolls
 
yes, I can type it in under 1.5 seconds
 
lol
i mean
innerHTML vs DocumentFragments
if you dont need element refs or bindings
 
@ChadScira implementation and environment specific
it varies
it's a case by case thing
I recommend not using innerHTML because it's a dirty hack
 
2:33 AM
lol
they should have made it slow then
man
this week has sucked, my coworker took this week off right when shit got super busy... and the project he has been working on for weeks is going through QA... and its got lots of wonderful "features"/bugs.
 
so innerHTML is only really bad because of how it is implemented in certain browsers (cough cough IE)?
 
@Matt No, innerHTML is bad because you're invoking a state machine to build you a DOM tree that returns a fragment.
You already have the whole dom tree there for you, all you need to do is learn how it works.
It's not how it's implemented, it invokes the code that renders the page the first time.
But it invokes that code and loads a parser every single damn time.
 
@Matt no, innerHTML is bad because the DOM is not a string
 
It's like you throw the whole damn thing into the woodchipper and hire a team of cheap labour to glue the bits together for you into something you kind-of asked for.
3
 
2:46 AM
@Raynos I think we need to start saying a tree structure of objects is not a string.
 
that's a much better explaination than saying "it's like using cats to make steak"
 
@Matt I think that's how I explained it.
@Raynos When people see DOM they think "Oh that innerHTML string thing.", so they end up reading "The string is not a string."
 
why does it not just parse your string into nodes and append it?
 
@Matt Eh?
That's exactly what it's doing.
It invokes the state machine that parses HTML
Then it invokes the code that builds the DOM tree
then it builds a DOM fragment
Then it returns to you a nice dom fragment with that tree.
hopefully.
I don't think you grasp how computationally expensive that is. One moment.
 
prolly not
 
2:51 AM
function innerHTML(node, html) {
  while (node.firstChild) {
    recursivelyDestroy(node.firstChild);
  }

  var p = createNewHTMLParser();
  var nodes = p.parse(html);
  nodes.forEach(appendTo(node));
}
 
This is only a small part of what happens in firefox 9 when you do that
 
@Matt the main issue here is that all you care about is nodes everything about that last time is computational overhead
 
That code loops through character by character to discover what the hell you were trying to do, rather than you simply say createElement("span")
It does that every time you set innerHTML=x; Where x is anything except an empty string.
This is only the main loop of the state machine.
This isn't even building your DOM tree.
 
My personal favourit is innerHTML+=trolls :3
 
@Raynos Mine is when they do it inside a damn loop.
 
2:54 AM
it's like throwing everything away, running most of your code (plus a minor addition) back through the HTML parser
You know for the lulz
Its like doing a.innerHTML = a.innerHTML
 
@Raynos I showed you the guy that was on about making a jQuery list plugin cranked for speed, that brushed my little innerHTML assassinates performance under the rug, right?
@Raynos Interestingly enough, that'll give you weird ass results with specific cases in IE6.
Ever use the DOM element api where you needed to use the table API? It's like trident KNOWS it's there, but won't render it.
 
@Incognito care to share that one again ?
i think i missed it
 
@tereško It was on github, I'll find the link for you, one moment.
> I've been thinking about this for I while and have come to the conclusion that even if innerHTML is less good for performance, it's still needed because the values could sometimes be html-content.
I tried to hard not to morph into my nerd rage volcano.
 
0
A: Redis, node.js and Javascript Callback Scoping / Flow

racarOne way to achieve this without using another library is using the "recursive pattern". You can't do some asynchronious call in a for loop. card_keys need to be an array. Some useful link about how to write for loop : http://tech.richardrodger.com/2011/04/21/node-js-%E2%80%93-how-to-write-a-...

 
the browser parses your page easily enough. what's a few more strings of HTML added later?

Only reason I like the idea of innerHTML is that it simplifies things and is quicker to write. When I'm thinking about appending dom nodes dynamically it would be nice to use the same syntax (HTML) that I used to create the page in the first place.
 
2:59 AM
Turns out mysql only does one database action at a time, (i.e. it blocks). i.e. mysql is a massive bottleneck on node :\
Classic "dont use blocking IO in your non blocking IO"
 
@Incognito my condolences
 
I never liked the matrix movies too much
 
how about religions ?
 
no really, I'm trying to google that. What is trinity?
 
3:02 AM
@Matt follow the link?
 
derp... I just trolled myself
 
@Raynos You know, if you call it triforce you'll be on the frontpage of reddit in -5 seconds.
 
@Incognito why? Do you think it's worth renaming to triforce?
 
@Matt duckduckgo is best search engine.
 
"triforce" sounds like some STD
 
3:04 AM
@Raynos No, I think reddit loves silly memes too much to even consider evaluating what you've made and simply promote it because they like The Legend of Zelda video games :P.
 
figured out what was happening with the stylesheets by the way
 
"You like cats?! You named something after cats?! OMG OMG THIS IS THE BEST THING EVER!!!11"
Add some site with refrences to ganondorf and link, rounded corners, you're golden.
 
because of the html injection the stylesheet object was losing its element ref
 
@ChadScira orly?
 
it was stale
 
3:06 AM
wait
@ChadScira Are you trying to implement css in javascript?
 
lol
 
you really don't want to know
 
yes, and dont give me anymore shit
lol :P
this is for my personal use not work
 
Should I do it?
 
Well, there's my scary story for the night.
 
3:07 AM
@Raynos yup, triforce if you want lots of traffic - although not if you want to be taken too seriously
 
@Incognito not only css , but html too
 
@Raynos Ahah, it's your call man, it's a marketing move.
 
But it's the triforce of html, css & js !
 
lol
 
@Incognito I can rename it back to trinity after traffic
 
3:08 AM
@tereško html and css as javascript?
 
yeah
 
+ he is using p.a.c.k.e.r on top of it all
 
He's going to kill us all.
 
lol
... im just trying to break the internet
 
3:09 AM
@Raynos You'll have to make a silly landing page that explains it but has references to the videogame.
@ChadScira y u no read my 1/10th completed 200 page thing about not breaking the internet?!
 
it doesn't have enough pictures
 
@ChadScira I'm actually making a svg that describes what happens when you invoke innerhtml
so far it's about 35 pages long.
That's all one picture.
 
anyone know if it's any better to use jQuery("<SPAN>text</SPAN>")?
 
What?
Any better than what?
 
You don't speak jQuery?
innerHTML
 
3:21 AM
I only speak esperanto and live in a cave with my vintage T shirts and fixed wheel bikes.
also I don't listen to bands, simply sound projects.
 
hipster...
 
I've been sick for five weeks and I'm over-tired writing code, give me a break :P
 
I'm trying to write out the equivallent of setting innerHTML in jQuery... 1 minute
 
wat? jquery's all innerhtml
 
I imagine it's just calling innerHTML under the hood
 
3:23 AM
something.html("blah") is all it does.
That's all it does.
 
ok
 
just stop using jquery and learn javascript
 
	html: function( value ) {
		if ( value === undefined ) {
			return this[0] && this[0].nodeType === 1 ?
				this[0].innerHTML.replace(rinlinejQuery, "") :
				null;

		// See if we can take a shortcut and just use innerHTML
		} else if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
			(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
			!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {

			value = value.replace(rxhtmlTag, "<$1></$2>");
 
hey, I learned JavaScript first
 
note to self: pastebin or something.
 
3:24 AM
jQuery came later
my boss would never let me not use jQuery
and by my boss I mean Jesus
wwjd - use jQuery
 
dont mess with me brah i listen to underground hiphop
 
3:50 AM
is there someone use mootools?
 
4:17 AM
RT @IE: New blog recap: A successful W3C Developer Conference http://windowsteamblog.com/ie/b/ie/archive/2011/11/23/w3conf-successful-w3c-developer-conference.aspx #w3conf cc @w3cConf
 
4:29 AM
RT @ChromiumDev: Happy Thanksgiving! Learn how to use CORS over the holiday weekend. Using CORS - http://www.html5rocks.com/tutorials/cors/ ^eb
RT @__DavidFlanagan: If my IndexedDB example made no sense, mark your calendars for this free Mozilla webinar by @SickingJ: http://t.co ...
RT @stshank: Game-controller API is arriving in browsers, starting with WebKit. http://bit.ly/rR8jqJ #cnet
 
 
2 hours later…
6:06 AM
posted on November 24, 2011 by Vasilis

Preferred solutions for responsive images « Cloud Four So if we could decide right now how responsive images should work in the future, what would the ideal solution be? Jason Grigsby looks at some possible solutions. images, responsive, future Make sure to use correct meta viewport syntax – MiniApps Blog I think it’s because of one early article about the meta viewport that

 
 
2 hours later…
8:24 AM
Good morning
 
@Rasmus Morning.
 
@RobinAndersson I AM NOT ALONE!
 
Good morning
what's time it is?
 
Here it's 09.:35
 
@Rasmus ahe,Good morning realy!
it's 16:37 in my place.
 
8:37 AM
@island205 living on Hawaii or something? :o
 
@RobinAndersson in China
i am a normal chinese
 
@island205 What do you mean by 'normal chinese'? :D
 
another chinese
@Rasmus there are a lot of chinese,i am one of them,and have no special。
 
8:59 AM
@island205 Pff, dont be so humble =)
 

« first day (404 days earlier)      last day (4527 days later) »