Here is the list of the JavaScript Snippets so far:
toggleBoolean
UppercaseFirst
Trim
isNumber
[**]...[...]
I am trying to make this post communality-wiki, please try to NOT to upvote until this post is not mine
thanks -- I'm a complete novice, but I'm not really sure how node works. I'm developing an interactive web application with a client-server architecture
its a board game
ive got the client side working, now I want to make it so multiple people can look at the same board
but I don't know how to "install" node.js -- I have server space my school provides but I don't have administrator privileges
I am quite new to javascript and I wonder if you experts can see any obvious mistakes (bad javascript coding) below? Or if there are any good improvements?
The code is working...
// add iframes to page
var normal_sortables = document.getElementById('normal-sortables');
normal_sortables.innerHTM...
wtf is it with people having to say "it's .on in jQuery 1.7 not .delegate" pisses me off. :( It doesn't look like they will remove the "old" methods anyway and I'd rather use them than some mega overloaded one :(
var slice = Array.prototype.slice;
function beget(proto) {
var o = Object.create(proto),
args = slice.call(arguments, 1);
o.constructor(args);
return o;
}
function make(proto) {
var o = Object.create(proto),
props = slice.call(arguments, 1);
extend(o, props);
return o;
}
function extend(o) {
var other = slice.call(arguments, 1);
other.forEach(copyProperties);
return o;
function copyProperties (source) {
Object.getOwnPropertyNames(source).forEach(copyProperty);
function copyProperty(name) {
o[name] = source[name];
}
}
}
var Animal = {
constructor: function (hasLegs) {
this.hasLegs = hasLegs;
}
};
var FlyingAnimal = extend({}, Animal, Flying);
var Penguin = extend(Object.create(FlyingAnimal), {
fly: function () {
console.log("PENGUINS Y U NO CAN FLY");
}
});
new is faster and you can't make initialization code any easier, it's built in. And since you need to use a library anyway, you could just as easily use a library so you don't need to do the ugly x.prototype stuff.