This file contains 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 removeDuplicateObjects(arrayOfObjects) { | |
let newObj = new Set(); | |
arrayOfObjects.forEach(item => newObj.add(JSON.stringify(item))) | |
return Array.from(newObj).map(item => JSON.parse(item)) | |
} |
This file contains 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 getUniqueProps(arrayOfObjects, propToCheck) { | |
let newObj = new Set(); | |
arrayOfObjects.forEach(item => { | |
newObj.add(JSON.stringify(item[propToCheck])) | |
}) | |
let result = Array.from(newObj).map(item => { | |
return { [propToCheck]: JSON.parse(item) } |
This file contains 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
// | |
// Declare function | |
// | |
$scope.getNotifcations = headerSvc.getNotifications().then(function(resp){ | |
$scope.notifications = resp.data | |
for (var i = 0; i < $scope.notifications.length; i++) { | |
$scope.notifications[i].title = '' |
This file contains 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
GetBookmarks : function(req, res) { | |
var results = [] | |
// | |
// Get array of IDs for specific user | |
// | |
db.query("SELECT bookmarks_list FROM users WHERE id="+req.params.user_id, function(err, resp) { | |
if (err) {console.log(err)} else { | |
var bookmarks = resp[0].bookmarks_list.split(',') |
This file contains 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
import React, { Component } from 'react'; | |
import Bed from './Bed'; | |
import "../../styles/dndbed.scss"; | |
import { removeStudentFromApt } from '../../actions/action_student' | |
import { connect } from "react-redux" | |
class Room extends Component { | |
render() { | |
This file contains 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
import React, { Component } from 'react'; | |
import Room from './Room'; | |
import Bed from './Bed' | |
import Student from './Student'; | |
import ApartmentListFilter from "../ApartmentListFilter"; | |
import "../../styles/dndbed.scss"; | |
import "../../styles/housingcontainer.scss"; | |
import { connect } from "react-redux" | |
import { getStudents } from "../../actions/action_student" | |
import { getApartments, getRooms } from "../../actions/action_apartments" |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |