« first day (423 days earlier)      last day (4750 days later) » 

19:01
ONE BOX >:(
Y U NO ONE BOX
IFRAME Y U NO ONE BOX
hmm I wonder why there isn't originally just a .remove() instead of removeChild
instead you need to do this.parentNode.removeChild(this) a 100% use case
@Esailija remove is coming in DOM4 soon(TM)
cool but I am really just wondering what was the original intent and thought behind that decision
all the node manipulation methods are sugar on manipulating .childNodes
that's all. Your only allowed to manipulate .childNodes of your Node through the methods
There is no node.removeMeFromAChildNodeIDontOwn()
well no, you have a ton of methods that you can just do directly on the node ?
19:07
There is no direct method which manipulates the .childNodes a node lives in
I see
so DOM4 will finally deflower that purity by introducing .remove?
19:22
I wonder if it would be cool to reinvent jQuery on Element, HTMLCollection and NodeList prototypes.. you know just for the lolz
there doing that already -.-
Element.prototype.find
document.body.find(I_HURD_U_LIEK_SELECTORZ);
user1385191
MORE STRINGS FOR THE STRING GOD
user1385191
MORE
you would most likely gain a lot of speed from it but lose cross browser support
user1385191
no
user1385191
19:25
there is no speed advantage for selectors
user1385191
it's convenience, nothing more
I didn't mean selectors but the fact that there is no wrappers would mean some speed advantage, no?
I supposed document.getElementsByTagName("div").remove() is a lot faster than jQuery equivalent
Over jQuery, sure
< just ordered 1500 sheets of origami paper...
that should be enough till christmas!
@IvoWetzel Nice! The only origami I've done recently is with chopstick wrappers and straw wrappers, but I used to be pretty into it.
I made a dozen roses for a girl once - she loved it (and still has them)
19:30
@Esailija it always is :\
@RyanKinal :)
I made 3 babies for a girl once, (she still has them as well)
It's original japanese paper from an Amazon reseller, so it should be way better than what I have now
I'd also replace selectors with functions as in

document.body.find( function(){
return this.nodeName == "div" && this.textContent == "hello";
});
19:31
@Loktar So... you got 3 lovely children?... Right?... Right? ... RIGHT? :(
haha yes
I dunno I just have a stupid urge to write a library like that -.-
@Esailija thats not how find works
find throws an error if you dont use a string
want you want is walkRecursively(node, cb)
No I meant anything that takes selector in jQuery would take a callback instead
in the hypothetical library
gist: All the DOM recursion you'll ever need, 2011-12-13 19:34:50Z
function recursivelyWalk(nodes, cb) {
    for (var i = 0, len = nodes.length; i < len; i++) {
        var node = nodes[i];
        var ret = cb(node);
        if (ret) {
            return ret;
        }
        if (node.childNodes && node.childNodes.length) {
            var ret = recursivelyWalk(node.childNodes, cb);
            if (ret) {
                return ret;
            }
        }
    }
}
That's my one and only dom walking utility function
19:37
it just returns a single node?
it returns the first thing you return
var filter = [];
recursivelyWalk(elem.childNodes, function (node) {
  if (condition) filter.push(node);
});
The returning something is just the equivelant of break; in a for loop, it's a loop short cutting optimization
I c but it's not very sugary, having to create an array outside
...
and in the library all the methods would be in Element, HTMLCollection and NodeList prototypes, not array
You want a recursivelyMap function instead?
you know you get shot right?
If you extend host objects with propietory crap
prototype did that
19:40
sure but that was how the discussion started
Make jQuery but on the prototypes instead so no wrappers :D
no it didnt
you just added it in for dem trolls
thers a reason jquery is not on the prototypes
because popular crossbrowser library can't do that... but my for the lulz library can :D
;_;
but I am not even creating it because it's just an urge that I'm waiting to pass
@MattMcDonald recursivelyWalk has 4 indentdations. Does that mean the if node.childNodes bit should be its own function?
19:46
@Raynos I modified it a little do you have the unit test page
So I can see if it still works the same :D
19:59
If my table has no thead should I put the body in a tbody or is that overkill at that point
20:10
jsfiddle.net/zdHDA how does it looks ?
Couldn't you just have used a custom cursor :P
user1385191
@Raynos probably a helper
user1385191
I've spent the past 2 hours or so slimming down class methods
I get the I-Beam if I try to click and drag
Anyone here use command-line email clients?
user1385191
20:14
my favorite nomenclature is verbPlural (usually a loop) and then verbSingular
@Esailija no fun :3 lol
user1385191
so traverseNodes and traverseNode, etc
i am thinking of just letting the user use the OS cursor :| .. mine kinda sorta looks very .....
@MattMcDonald, I just changed it this.. seems to do the same thing
function recursivelyWalk(nodes, cb) {
  var i, node, ret, len = nodes && nodes.length;
  if (len) {
    for (i = 0; i < len; i++) {
      node = nodes[i];
      ret = cb(node) || recursivelyWalk(node.children, cb);
      if (ret) {
        return ret;
      }
    }
  }
}
user1385191
ugh
user1385191
20:16
you're using short indentation as a crutch
I thought the original was 2 spaces as well
user1385191
you get one if and a for loop
user1385191
the rest goes in a helper
what could you put into a helper function in my version
user1385191
blech
20:21
for what it's worth I don't think it's a very useful method
or function
it takes an array but returns a single truthy value and even that value is just the first thing it happens to come across
maybe It's just me though
user1385191
20:37
function recurseNodes(parent, callback)
{
	var output;
	if (condition) {
		output = traverseNodes(parent, callback);
		return output;
	}
	return null;
}

function traverseNodes(parent, callback)
{
	var i = 0,
	nodes = parent.childNodes,
	limit = nodes.length,
	node,
	result,
	output;
	for (i;i<limit;i++) {
		node = nodes[i];
		result = callback(node);
		output = output.concat(
			checkResult(result);
		);
		output = output.concat(
			traverseNode(node, callback);
		);
	}
	return output;
}

function checkResult(result)
(see full text)
user1385191
ugh
user1385191
there's helper methods at work
20:48
I could reduce it to 1 if check :pp
function recursivelyWalk(nodes, cb) {
    var i, node, ret,
        len = nodes && nodes.length || 0;

    for (i = 0; i < len; i++) {
        node = nodes[i];
        ret = cb(node) || recursivelyWalk(node.children, cb);
        if (ret) {
            return ret;
        }
    }
}
@Esailija unit tests? o.o
yeah I meant to check if it still does the same thing as the original @Raynos
@Esailija dont use node.children
@Esailija you can fork the DOM-shim and plug your version in
why not
Because children is only elements I want childNodes
20:52
sure, you can change it then but I don't find the function any useful at all in the first place :P
is the function in DOM-shim? i couldn't find any tests there for it @Raynos
it doesnt have tests :D
but the DOM-shim uses it, so swap it rebuild and run the unit tests
well you should have tests for it :P it tries to find matches from the first node and its children before even moving on to the next element in the original collection which would make more sense, no ?
yes
it goes in tree order
I see
yea it's actually correct, never mind the talks of feverish esailija :)
its ok :3
21:12
:D another desable post
0
Q: Java-script desable

dddIs there any way to desable javascript when generating page with php... Code: <?php $url = 'http://www.kupime.com/'; $data = file_get_contents($url); $data = '<head><base href='.$url.' target="_blank" /></head>'.$data; echo $data; ?>

what is the most efficient way to remove an element from an array (not knowing it's index in the array - only it's value) ... [].forEach(function(val) {
user1385191
let's see the data
@rlemon I think you have to get dirty and lookup the index ?
that data will be integers.
Is it sorted? Is it a long or short array?
21:17
it's an array of indecies from a table. not sorted.
if it's integers and sorted you can use binarysearch to make the lookup really fast
it's for a filter - users can select a number of options, each selection adds the id to an array which i later use to filter the data.
i could sort it i suppose.. won't make a difference in the end.
If it's short enough (whatever that means), just traverse the entire array.
i'm just trying to remove the value from the array if the user removes that filter option.
user1385191
the id added is unique, correct?
21:19
or if the integers are unique you could use an object...
user1385191
^^^
here's the thing. There are hundreds of options to choose from and I can't limit the number of options the user can select. they should only select a few but could end up selecting all but one kinda thing.
user1385191
a hash table is also an option
user1385191
if you can guarantee it's unique
i didn't think of that.
yes 100% unique
they map to db id's so they have to be
21:20
cool
user1385191
a js hash table would have an object with the ids as keys
user1385191
and the values as indexes in an array
similar to c# hashtable
user1385191
then you write wrapper methods to add/remove keys
that kinda thing is not language specific no?
21:21
js objects act as hash tables as is, afaik
but I don't have any CS background so I won't get into the technicals too much :P
@Esailija more or less ...
user1385191
the upshot of hooking it up to an array is you can sort it, etc
user1385191
but you'd need to write wrappers for that as well
Yea stackoverflow has chat... And it works on ops!
user1385191
so probably just an object
21:23
*iOS
@bhazzard, iOS has a web browser? what do you mean :D
did you try to xss us? naughty
how does stack overflow manage HTML markup when sending a message in markup language
It allows you a specific subset of html, and only in a specified form.
the message also preserves the new lines aswell
21:31
117
Q: What HTML tags are allowed on Stack Overflow, Server Fault, and Super User?

Jeff AtwoodThe Stack Overflow site engine, as you know, uses Markdown for questions and answers. Per the Markdown spec, you are allowed to freely intermix HTML and Markdown tags. However, we do not allow all HTML tags, as that would be an XSS paradise. To that end, the Stack Overflow engine allows only the...

<ol> <li> y u no </li> </ol>
0
Q: Refactor this function that moves circles along a ray to eliminate location check

ThinkingStiffI have a function that moves circles out of the way of an expanding circle. It moves them along a ray from the center of the expanding circle through the center of the circle to move. This allows all surrounding circles to move without overlapping. Here's a diagram to better explain this: I ex...

Need. Louder. Speakers.
21:57
did I miss anything
@ThomasBlobaum My speakers burst into flames. That count as anything?
0
Q: How can this simple handler in NodeJS be improved?

bsiegelI have a pretty simple script which I am running in NodeJS (v0.6.5) to handle requests for two different host names. The script sends back a different response based on the hostname of the request, and the responses are very small (headers only). I left it going over the weekend, and on Monday m...

22:30
morning every one
anyone here awake?
22:47
It's afternoon for the majority of us, so I imagine so
happy morning in Melbourne :0
:)
10 mins to quitting time :D
although I almost don't want to go home... working on a fun project
otoh I get to chainsaw some lumber into firewood when I get home...
morning here in Adelaide - finishing up for the year on Friday
23:13
RT @IanET: Chrome gets support for profiles http://chrome.blogspot.com/2011/12/get-your-personal-chrome-experience-on.html along with new CSS properties and a lot of Web Inspector goodness http: ...
RT @tobie: Great slides on ES5: http://www.slideshare.net/ferrantes/ecmascript-5-10575898
RT @paul_irish: Phenomenal slides about polyfills, cross-browser HTML5 and feature detection. A must read. http://addyosmani.com/polyfillthehtml5gaps/slides/ by @addy ...
RT @beverloo: CSS Filter Effects have been enabled for Chromium, coming to Canary and Dev soon! http://goo.gl/u43L3 http://t.co/qhIiwMm ...
RT @ebidel: What's New in CSS4 selectors. Parent selectors are huge! http://www.2ality.com/2011/12/css4-selectors.html
RT @dalmaer: Esprima: JavaScript Parser in JavaScript: Ariya Hidayat has created an educational and highly performance JavaSc... http:// ...
FEEEEEEEEEEDS
Do you have to eat so loudly? :-)
I have a noob question... I've been trying to figure this stuff out and I can't say I know how this works (which bugs me). When you post to a server using PHP through a form, how is it sent... is it sent as a parameter list in the URL or... what?

Forgive my noobness -___-
...
-1
A: Can someone explain the dollar sign in Javascript?

Ben AtkinThe $ variable is a handy alias for jQuery that makes some common things faster to type. It's great for using in the JavaScript console, but when using it in jQuery plugins or other code that's likely to be shared, it should be used with care. Some other, incompatible libraries use the $ symbol, ...

23:27
Still have me ignored Incongnito?
user1385191
the behavior you're thinking of is a GET request
user1385191
<form ... method="get">
AWh snap, @MattMcDonald beat me to it.
user1385191
I've got it bookmarked :)
user1385191
23:30
it's been massively helpful
lol XD thank you @MattMcDonald and @Incognito! I will read through some of this tonight... is there a printable version that you know of?

Thank you so much again!
That's pretty hard core.
user1385191
especially OPTIONS + Allow
user1385191
@Joseph Just google around for the rfc2616 until you find something suitable.
Or add the words "printable version"
user1385191
23:31
(link is on the bottom of the HTTP/1.1 html page)
FFFFFFFFFFFFFFFFFFFFFFFFF I need more JavaScript on my GitHub
@MattMcDonald For rest API I suppose?
oh ok! I see... didn't realize what that link was at first
user1385191
well, for my blog project
user1385191
for example, I only allow GET, PUT, and DELETE to /posts/
23:32
What are you using it for?
Hey Ryan.
I don't get outside of the basic 4 very often, actually, I stick to the two mostly.
meaning get/post and delete/put.
user1385191
I just think it's so cool that you can block request types
user1385191
I should be finally pushing the thing to github this weekend, so you can look if you want and critique it
Sounds pretty cool, I didn't even know you were working on a blog.
I just use blogger because I don't want to deal with bandwidth or bugs.
user1385191
23:36
I spent sunday night cleaning up static queries
user1385191
didn't even cross my mind before that to use constants for the queries
What language is this?
user1385191
PHP
user1385191
I store the static query as a constant then prepare it with PDO
Are you not using a parametrized query option
Ahh.
23:38
@RyanKinal why you not git awesome
@Raynos ... er... what?
@MattMcDonald y u no post to posts :( what if you want to overwrite all your posts with a list of posts
@RyanKinal I kind of meant, just sit down, write javascript and publish it on github \o/
user1385191
that's what PUT is for
PUT is to add a new member to the collection
POST is to overwrite the entire collection with a new collection
@Raynos lol, I need to figure out some cool stuff to do with JS first
user1385191
23:39
mm
or if you prefer, PUT is to change add/overwrite a key/value pair in hash, POST is to overwrite the entire HASH
user1385191
2 weekends ago, it was getting caching working
@Raynos Is put supported by most browsers? :S
so PUT /posts/:id/comments { "uniqueId": "commentData" }
@Incognito no. but <input type='hidden' name='method-overwrite' value='put' /> is a common work around
I love that IBM got us all calling them collections :)
23:41
Well really its a hash
fsck I miss mainframe computers, I felt so cool.
/posts/:id -> posts = { ":id": value }`
user1385191
I think I spent an hour tinkering with httpd.conf before realizing how caching actually worked in the browser :)
-2
A: Can someone explain the dollar sign in Javascript?

Ben AtkinThe $ variable is a handy alias for jQuery that makes some common things faster to type. It's great for using in the JavaScript console, but when using it in jQuery plugins or other code that's likely to be shared, it should be used with care. Some other, incompatible libraries use the $ symbol, ...

MOCK MOCK MOCK HIM
How cross-browser is using a function in the String.replace method?
user1385191
23:43
that seems to have been around for a while
Are you talking to me Matt?
user1385191
I'll give it an ancient browser test
xD Maybe I should install a older version of IE for a little tests later on as well. The lowest browser I try to support is IE8.
user1385191
that's pretty sad
@MattMcDonald your pretty sad
23:46
0
Q: "Hello World" in MVC Pattern

hrishikeshp19In an interview for some company, I was asked this question. What design patterns do you know...then I was told to write simplest "hello world" application based on MVC Design Pattern. I came up with a JavaScript program var arr = ["a","b","c","d"] // this is an array, same as store or model...

@Raynos Epic troll.
user1385191
ancient browser test failed
user1385191
it returns the function as a string
String.prototype.ucwords = (function() {
  return this.toLowerCase().replace(/\b[a-z]/g, function(match) {
    return match.toUpperCase();
  });
});

("abc test").ucwords(); // "Abc Test"
user1385191
don't augment the prototype
user1385191
how hard is it to pass the string as a parameter?
23:51
@MattMcDonald When to extend natives (TL:DR; it's a personal style choice)
user1385191
"no-one else is going to use it." ...except if someone else has to use it at some point
user1385191
ie: you get fired or move on
...
That's not how it works, no-one else but your team is going to use it
extending prototypes or not is a team decision
user1385191
so what happens when I get tossed a legacy application that augments the prototype, and I somehow trip up on a dangling method?
As long as the name in which you're extending to the prototypes aren't already extended by default, (i.e: toString, valueOf, ect...) then I see no problem in adding them. I didn't ask for a conflict, I am just asking for a better way to do what is above that will work cross browser. Now can we end this conflict?

« first day (423 days earlier)      last day (4750 days later) »