This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var groupCopy = _.cloneDeep($scope.group); | |
groupCopy.calendarDates = groupCopy.calendarDates.map(function(calendarDate) { | |
return _.omit(calendarDate,'source'); | |
}) | |
// $http.put('api/groupss/' + $scope.group._id, groupCopy).success(function(data){ | |
// $scope.group = data; | |
// console.log(data); | |
// }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Our input. An array of objects containing all original meeting times. | |
[ | |
{startTime: 0, endTime: 1}, | |
{startTime: 3, endTime: 5}, | |
{startTime: 4, endTime: 8}, | |
{startTime: 10, endTime: 12}, | |
{startTime: 9, endTime: 10}, | |
] | |
// Our output. An array of objects containing all meeting times merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We should consider these meetings as overlapping | |
[{startTime: 1, endTime: 2}, {startTime: 2, endTime: 3}]; | |
// Overlapping meetings! How can we overlapping meeting programitically? | |
[{startTime: 4, endTime: 6}, {startTime: 5, endTime: 7}]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mergeRanges(meetings) { | |
// sort by start times, slice will return a shallow copy of the array, not affecting original array | |
var sortedMeetings = meetings.slice().sort(function(a, b) { | |
return a.startTime > b.startTime ? 1 : -1; | |
}); | |
// initialize mergedMeetings with the earliest meeting | |
var mergedMeetings = [sortedMeetings[0]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var complexObjects = { | |
complexProp: "1", // access via complexObjects.complexProp | |
simpleProp: "2", // access via complexObjects.simpleProp | |
regularProp: 5 // access via complexObjects.regularProp | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create object with numbers as keys | |
var object = { | |
1: "First Name", | |
2: "Middle Name", | |
3: "Last Name" | |
}; | |
console.log(object.1); // Uncaught SyntaxError: Unexpected Number | |
console.log(object."1"); // Uncaught SyntaxError: Unexpected String | |
console.log(object[1]); // "First Name" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var person = new Map(); | |
person.set("Formal Name", "Kanye West"); | |
person.set("Alias", "Yeezy"); | |
person.set("Goal", "GOAT"); // don't stop reading here! | |
console.log(person.has("Formal Name")) // true | |
console.log(person.size); // 3 | |
person.delete("Goal"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The following is a "driver" file for your TempTracker.js class. | |
The TempTrackers class you are creating should support all of these methods, | |
and return the values commented out, at the end of every console.log function call. | |
*/ | |
var tmp = new tempTracker(); | |
tmp.insert(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pokemon = { | |
firstname: 'Pika', | |
lastname: 'Chu ', | |
getPokeName: function() { | |
var fullname = this.firstname + ' ' + this.lastname; | |
return fullname; | |
} | |
}; | |
var pokemonName = function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pokemon = { | |
firstname: 'Pika', | |
lastname: 'Chu ', | |
getPokeName: function() { | |
var fullname = this.firstname + ' ' + this.lastname; | |
return fullname; | |
} | |
}; | |
var pokemonName = function(snack, hobby) { |
OlderNewer