« first day (612 days earlier)      last day (4335 days later) » 

12:12 AM
Waiting at the hairdressers.... girfriend needs to learn driving.... hard smartphone coding
My hiku
 
12:57 AM
not that there are a lot of hair to dress
 
MG1
1:34 AM
@rlemon I didn't go through your code yet.. but I will .. thank you again!
 
RT @joewalker: Blogged: Firefox Command Line for Developers - http://incompleteness.me/blog/2012/06/18/firefox-command-line/
RT @Tojiro: The book I co-authored, WebGL Beginners Guide, is now available to order from Amazon, Barnes and Noble, and more! http://t.c ...
RT @jon_neal: I cover polyfill and prototype basics in my new blog http://www.jonathantneal.com/blog/polyfills-and-prototypes/
 
 
2 hours later…
3:09 AM
@Feeds Doesn't look like much there that you can't do better with js in the console, no? Anything more complex and I'd resort to greasemonkey. I'll give it a shot when it comes out though.
 
user1385191
 
user1385191
zed shaw hits the ball out of the park on that one
 
0
Q: Precisely how will certainly PvP always be executed throughout Diablo 3?

eciliaIntended for your multiplayer portion of diablo iii gold , your stress are going to be in cooperative participate in, nevertheless many of us will likely incorporate assist pertaining to cut-throat participate in. Precisely what variety that will assist is going to take remains to be staying ment...

Video presentation of @annevk explaining “What XML can learn from HTML; also known as XML5” http://www.youtube.com/watch?v=nhVfIyFPWAA
 
@FlorianMargaine lol watch this this is great vimeo.com/43380467
 
no subtitles, and I'm at work
so, no :D
oh btw I was wondering
in a switch, the break for the default case is useless, isn't it?
 
Yes, the last case doesn't need a break
 
yeah I think so
 
I'd say it's cleaner to include it anyway
 
8:02 AM
it may not be computationally effective
I mean, it's one more statement
:p
 
good day all
 
8:37 AM
anyone know a good plugin in chrome to track XHR
Actually chrome not show me request which is made before I open chrome debug tool.
 
what do you mean track XHR?
 
XMLHTTPrequest , ajax request to server.
 
oh, just turn on the recording
 
I want all request logged before I open the tool. Chrome not show me request they have made before I opened them.
 
8:42 AM
that's still O(n²)
and it removes false null etc
I think
it was meant for strings
 
o/
 
good morning
 
@FlorianMargaine cv ?
 
@GNi33 Do you have see ro.me It's fantastic.
 
8:56 AM
yes, has been around for a while
 
I have update the link.
 
i know what you mean, ro.me has gained some fame ;)
 
9:10 AM
@Esailija thanks for the edit :)
I always forget about this :D
 
I'm thinking of blog post but here is all content I have
Would you do this in PHP?

Class hello {

	public function __construct() {
		$private1;
		$private2;
		$private3;

		$this->$instanceMethod = function() use( $private1, $private2, $private3 ) {

		};

		$this->$instanceMethod2 = function() use( $private1, $private2, $private3 ) {

		};

		$this->$instanceMethod3 = function() use( $private1, $private2, $private3 ) {

		};

	}
}

Do you see how horrible that looks? That's exactly what you are doing in javascript. Stop doing that.
 
Model.create = function() {
    return new Model();
};
is it possible to do return new this();?
 
ye
this is not special
can any other language show how horrible that is other than PHP :D
 
hm
php is already horrible in itself
:p
 
but it has 100x more OOP support than js
 
9:14 AM
how to inherit static methods with this? — Matteo Pagliazzi 1 min ago
hm, you don't, right?
 
javascript doesn't have methods, let alone static methods
so you'd use some ad hoc bullshit
 
well, js is prototype based
 
that's not an excuse
php is frankenstein based and it has 100x better oop support
 
Object.getOwnPropertyNames( Model ).forEach( function( prop ) {
    InheritedModel[ prop ] = Model[ prop ];
} );
 
you wan't object keys
Object.keys(Model)
["create"]
Object.getOwnPropertyNames(Model)
["create", "length", "name", "caller", "arguments", "prototype"]
you only want "create" from there
so .keys :P
 
9:20 AM
oh
 
and it's not inheritance anyway
 
for cross-browser, getOwnPropertyNames and hasOwnProperty will work?
static methods can't be inherited, so it's a workaround
Object.create inherits the static methods though
 
what do you mean
it creates an object with the static properties in prototype
it's effectively the same thing
but less code I suppose
 
new doesn't do that
but yeah, Object.create is the same as new + copy Model's keys in new object
 
function f(){}
f.prototype = Model;

InheritedModel = new f;
also now the inherited model is not even a function
so go with the object keys
 
9:26 AM
so you're using a temporary f function instead of just using Object.create
 
no just saying how you could do the same with new
:F
 
why bother with object.keys if object.create is available?
 
because object.create doesn't create a function
how would you do new InheritedModel now
since it's not a function
 
what a mess
 
9:28 AM
yeah I get it
 
all you have is new
rest is hacked together with .call .bind and shit
how is that a good thing :)
any "benefit" from prototypal is already present in any dynamic classical language
 
@Esailija you can't do new on an inherited object btw
var InheritedModel = new Model();
var some = new InheritedModel; // fuck
 
you can't do new on an object
just on a function
 
but then, how to create an inherited function?
 
you don't :D
you have to create a function and copy properties at best
 
9:35 AM
    function InheritedModel() {}

    InheritedModel.prototype = Model.prototype;

    // Copy all the static methods in the InheritedModel object
    Object.keys( Model ).forEach( function( key ) {
        InheritedModel[ key ] = Model[ key ];
    } );
 
no don't do InheritedModel.prototype = Model.prototype;
this will make them point to the same object
 
so Model.prototype === InheritedModel.prototype
 
yeah you're right
hmmm
 
InheritedModel.prototype = Object.create(Model.prototype);
 
9:37 AM
yeah, it's ugly :D
 
you think that's ugly? what about all the this.parent.consturctor.apply(this,arguments) this.clicked = this.clicked.bind(this)
 
did you even notice that after doing `
InheritedModel.prototype = Object.create(Model.prototype);` and then `console.dir(new InheritedModel)`
it will look like shit
InheritedModel
__proto__: Model
__proto__: Model
constructor: function Model() {
__proto__: Object
why is Model twice there
because even this is a fucking hack
 
yeah I saw that
and thought "what the fuck?"
 
so you can't even do a clean prototype chain without using __ proto __
 
9:42 AM
and it's normal btw
 
prototype.......
headache.......
 
function Model() {

}

Model.prototype = {

	constructor: Model
};

function InheritedModel() {

}
InheritedModel.prototype.__proto__ = Model.prototype;
var a = {};
a.__proto__ = InheritedModel.prototype;

console.dir(a);
now the chain goes -> InheritedModel -> Model -> Object -> null
I see you can replace var a = {} with var a = new InheritedModel
but you still need __proto__
lol
 
@Esailija just use Object.create, seriously :D
var Model = {},
    InheritedModel = Object.create( Model ),
    a = Object.create( InheritedModel );
 
yeah but there is the extra gap for each level of inheritance that feels dirty
what the fuck is that
You think I'm gonna write Object.create( Model ).constructor( asd, asd ) over new Model( asd, asd) `?
 
do you always need a constructor?
 
9:51 AM
yes
ALWAYS
 
especially in javascript
setting up the .bind hacks takes place in constructor
and what kind of object doesn't have any data
which should be initialized in constructor
don't tell me to put empty array in prototype
because that's just begging for bugs
 
put empty array in prototype
IMMA REBELZ
 
do console.dir(a)
Object -> Object -> Object -> null
what if you want it clean like HTMLDivElement -> HTMLElement -> Element -> Node -> Object -> null
 
btw look at his edit on the question
imo his solution would be something like this now:
var ActiveStore = {
    create: function( type, args ) {
        if ( type === 'user' ) {
            return Object.create( this, {
                create: function( args ) {

                }
            };
        }
    }
};
but how to do static method on the returned object created?
or rather the other way
 
9:59 AM
my god, using the second argument for Object.create
 
yeah :D
 
Object.create( Something, {

	arr: {
		value: []
	},

	str: {
		value: ""
	}

});
that is so simple
I couldn't just write new Something()
even the .constructor() hack is cleaner
 
looks clean to me :/
what the heck
var ActiveStore = {
        create: function( type, args ) {
            if ( type === 'user' ) {
                return Object.create( this, {
                    // Static method on User
                    create: function( args ) {
                        return Object.create( this );
                    },
                } );
            }
        }
    };
 
you mean the 10 lines that can be replaced with new Something() is clean ? :P
 
var User = ActiveStore.create('user');
console.log( User ); // the static create method is undefined :/
@Esailija new has limitations :p
 
10:08 AM
what is the limitation in that case
the second argument to Object.create is an object descriptor
 
limitation = static methods
 
Object.create( this, {
	// Static method on User
	create: {
		value: function( args ) {
			return Object.create( this );
		}
	},
} );
 
I think you're misunderstanding something if you think Object.create somehow manages to do static methods any differently?
 
Object.create does copy the static methods
you don't need to loop over them and add them like when using new
 
10:13 AM
where does it copy them
function( proto ) {
	function f(){}
	f.prototype = proto;
	return new f;
}
 
this shim is not complete
 
I know
but the second argument doesn't make a difference
 
function Model() {}

// Methods in the instantiated object
Model.prototype = {
    constructor: Model,

    // Note that "delete" is a reserved word, so we need quotes
    'delete': function() {},

    save: function() {}
};

// Static methods
Model.all = function() {};

Model.find = function() {};

Model.create = function() {
    return new Model();

    // To be more generic, you can also:
    return new this();
};

var InheritedModel = Object.create( Model );
!!InheritedModel.all // true
 
InheritedModel:
1. is not a function now
2. does not inherit instance methods
if you were to do Object.create(InheritedModel) you wouldn't get instance methods on that object
 
1. of course, it uses Object.create
instance methods are inherited too
in Model's prototype
 
10:16 AM
console.dir( Object.create( InheritedModel) )
where are the instance methods?
Object.create( InheritedModel).delete is undefined for example
 
    function ActiveRecord( type, args ) {
        if ( type = 'users' ) {
            return new this.users();
        }
    }

    ActiveRecord.create = function( type, args ) {
        return new ActiveRecord( type, args );
    };

    ActiveRecord.prototype = {
        constructor: ActiveRecord,

        users: function( args ) {}
    };

    ActiveRecord.prototype.users.prototype = {
        constructor: ActiveRecord.prototype.users,

        // Instance method on User's instance
        save: function() {}
@Esailija oh, didn't go that far
is the example up there ok for OP?
 
I don't undertsand... if it's on prototype it's an instance method
not static method
 
return new this.users();
@Esailija Object.create( InheritedModel ).prototype.delete :D
 
yeah, except this refers to prototype inside the methods
var a = Object.create( InheritedModel ); a.prototype.delete.call( a ); or something
I suppose that's clean in your books
:D
 
@Esailija and this.users is a function in prototype
I've stopped talking about object.create there :o
 
10:22 AM
what is User
there is no benefit for stuffing a constructor in prototype
 
this is what he wants to achieve
var User = ActiveRecord.create('users',{
    username: '',
    password: '',
    post_count: 0,
    profile: ''
}
var jessica = User.create({
    username: "Jessica",
    password: "rabbit"
});
jessica.save();

User.findByUsername('Jessica');
and this is my proposition
function ActiveRecord( type, args ) {
    if ( type = 'users' ) {
        return new this.users();
    }
}

ActiveRecord.create = function( type, args ) {
    return new ActiveRecord( type, args );
};

ActiveRecord.prototype = {
    constructor: ActiveRecord,

    users: function( args ) {}
};

var Users = ActiveRecord.prototype.users;

Users.prototype = {
    constructor: Users,

    // Instance method on User's instance
    save: function() {}
}

// Static method on User
Users.create = function() {}
 
ActiveRecord seems to be some kind of base class, it cannot know about users
ActiveRecord.create should return a class that inherits from ActiveRecord
 
hm
dunno about this
 
I can give it a shot
 
yeah I wanna see what you come up with
 
10:33 AM
wow
it's 51 lines
function ActiveRecord() {
}

ActiveRecord.prototype = {

	save: function() {
		alert(this.tableName );
	},

	constructor: ActiveRecord
};

var activeRecordStatics = {

	create: function(obj) {
		return new this(obj);
	}

};

ActiveRecord.create = function( tableName, props, statics ) {

	function ActiveRecordC( obj ) {
		this.tableName = tableName;
		if( props ) {
			for( var prop in props ) {
				this[prop] = props[prop];
			}
		}

		if( obj ) {
			for( var prop in obj ) {
				this[prop] = obj[prop];
 
wow
how do you create User then?
 
I get cannot read property create of undefined :D
 
for( var key in activeRecordStatics ) {
		ActiveRecordC[key] = statics[key];
	}

	if( statics ) {
		for( var key in statics ) {
			ActiveRecordC[key] = statics[key];
		}
	}
twice?
oh wait
 
oops
 
my bad :D
 
10:36 AM
var User = ActiveRecord.create('users',{
    username: '',
    password: '',
    post_count: 0,
    profile: ''
})
 
hi everyone
 
works now
 
hi @GRIGORETURBODISEL :)
 
var jessica = User.create({
    username: "Jessica",
    password: "rabbit"
});
console.dir(jessica)
ActiveRecordC
password: "rabbit"
post_count: 0
profile: ""
tableName: "users"
username: "Jessica"
__proto__: ActiveRecord
 
@Esailija add this as an answer :p
 
10:36 AM
jessica.save()
alerts ("users")
var User = ActiveRecord.create('users',{
    username: '',
    password: '',
    post_count: 0,
    profile: ''
}, {
	findByUserId: function(id) {
		return id;
	}
});
User.findByUserId(23)
23
in reality it would do database lookup and return new this with the table field values as data
 
yeah
I wanted to avoid creating a dummy object (ActiveRecordStatics) and copying the properties
but looks like it's not possible
@Esailija you're adding this as an answer?
 
here's complete
find by user id is now redudant
 
hello
 
since the "inherited" static method find is good
 
may I ask: why developers declare variable in form of varLikeThis rather than var_like_this?
 
10:46 AM
@Edditoria Personal preference
 
actually I think the statics is useless
rather use methods
 
is there any practice that use var_like_this in some condition? (just like UpperCase to declare an object constructor)
 
hello everybody, does anyone know if its possible with jquery to edit and save appended input? With a button edit and save? Or do I need another programming language? jsfiddle.net/48Zmz
 
Has anybody taught somebody programming ever ? and i mean beginners those who just know syntax of C++
 
@FlorianMargaine Ok after some cleaning up it looks now like this jsfiddle.net/nYRWH/2
 
10:55 AM
@Opoe you can edit it (selector -> get data to input field -> save to selector)
 
@FlorianMargaine what a beast answer stackoverflow.com/a/11099585/995876
 
11:11 AM
@Edditoria thank you for your answer! So it is possible.
 
Hi all, how can I get the value of the current checkbox that has been unchecked using jquery?
 
RT @stevefaulkner: Notes on using ARIA http://www.paciellogroup.com/blog/2012/06/html5-accessibility-chops-using-aria-notes/ #HTML5 #accessibility #ARIA
 
@Dino hi, so the rest of the checkboxes is checked?
 
not necessarily
tried this but to no avail: alert($(this).val('checked', false));
 
hmmm
 
11:29 AM
this.checked
 
11:41 AM
jQuery: Teaching noobs how to write bad code since 2005.
 
anybody saw that its effing hillarious
 
@Dino: .prop('checked', false) - but if you have the plain DOM object available use .checked = false like @GNi33 suggested.
 

« first day (612 days earlier)      last day (4335 days later) »