Skip to content

Instantly share code, notes, and snippets.

View andevsoftware's full-sized avatar

Andev Software andevsoftware

View GitHub Profile
@andevsoftware
andevsoftware / baseobject.static.getter.ts
Created February 27, 2016 14:06
BaseObject - static - getter
class Animal extends BaseObject {
}
var animal = new Animal();
// animal.static returns Animal's constructor
//
// Animal() {
// _super.apply(this, arguments);
@andevsoftware
andevsoftware / data.collection.constructor.ts
Last active February 27, 2016 17:28
Data/Collection - Constructor
var collection = new TSCore.Data.Collection<Movie>([
new Movie("Deadpool", 2016),
new Movie("Triple 9", 2016)
]);
collection.toArray();
// [
// { title: "Deadpool", year: 2016 },
// { title: "Triple 9", year: 2016 },
@andevsoftware
andevsoftware / tscore.data.collection.add.ts
Last active February 27, 2016 17:32
TSCore\Data\Collection - add method
var collection = new TSCore.Data.Collection<Movie>();
collection.add(new Movie("Revenant", 2015));
collection.toArray();
// [
// { title: "Revenant", year: 2015 }
// ]
@andevsoftware
andevsoftware / data.collection.addMany.ts
Last active February 27, 2016 17:32
Data\Collection - addMany method
var collection = new TSCore.Data.Collection<Movie>();
collection.addMany([
new Movie("The Martian", 2015),
new Movie("Sicario", 2015),
new Movie("Jurassic World", 2015)
]);
collection.toArray();
@andevsoftware
andevsoftware / data.collection.remove.ts
Last active February 27, 2016 17:33
Data\Collection - Remove
var collection = new TSCore.Data.Collection<Movie>([
new Movie("The Avengers: Age of Ultron", 2015)
]);
var movie = new Movie("The Martian", 2015);
collection.add(movie);
collection.remove(movie);
@andevsoftware
andevsoftware / data.collection.removeMany.ts
Last active February 27, 2016 17:34
Data\Collection - removeMany method
var collection = new TSCore.Data.Collection<Movie>();
var movie1 = new Movie("The Avengers: Age of Ultron", 2015);
var movie2 = new Movie("Mad Max: Fury Road", 2015);
collection.addMany([movie1, movie2]);
collection.removeMany([movie1, movie2]);
collection.toArray();
@andevsoftware
andevsoftware / data.collection.removeWhere.ts
Last active February 27, 2016 17:53
Data\Collection - removeWhere method
var collection = new TSCore.Data.Collection<Movie>([
new Movie("Deadpool", 2016),
new Movie("Triple 9", 2016),
new Movie("The Martian", 2015)
]);
collection.toArray();
collection.removeWhere({ year: 2015 });
@andevsoftware
andevsoftware / tscore.data.collection.length.ts
Last active February 27, 2016 17:29
TSCore\Data\Collection - Length
var collection = new TSCore.Data.Collection<number>([1, 2, 3, 4]);
collection.length;
// 4
@andevsoftware
andevsoftware / tscore.data.collection.count.ts
Last active February 27, 2016 17:29
TSCore\Data\Collection - count method
var collection = new TSCore.Data.Collection<number>([1, 2, 3, 4]);
collection.count();
// 4
@andevsoftware
andevsoftware / tscore.data.collection.introduction.ts
Last active February 27, 2016 16:04
Data\Collection - introduction
var names = new TSCore.Data.Collection<string>(['jack', 'amy', 'robert', null]);
names.map(name => {
return name.toUpperCase();
}).reject(name => {
return _.isNull(name);
});
// ['JACK', 'AMY', 'ROBERT']