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
const PhotoEntity = require('../entity/photo.entity') | |
class PhotoDao { | |
/** | |
* | |
* @module Photo | |
* @description This method creates a new Photo instance and persists it to the database. | |
* | |
* @typedef {Object} Photo |
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
const { omit } = require('lodash'); | |
const DataSource = require('./data-source'); | |
const { DataTypes } = require('sequelize'); | |
const photo_log = require('../dao/photo_log.dao'); | |
class PhotoEntity { | |
/** @type {import('sequelize').Model} */ | |
photoModel = {} |
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
const DbConfig = require('../config'); | |
const Sequelize = require('sequelize'); | |
class DatabaseConfig { | |
/** | |
* @type {import('sequelize').Sequelize} | |
*/ | |
databaseClient = {}; |
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
export default [ | |
"Abia", | |
"Adamawa", | |
"Akwa Ibom", | |
"Anambra", | |
"Bauchi", | |
"Bayelsa", | |
"Benue", | |
"Borno", | |
"Cross River", |
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
/** | |
* Given a string, break the string down in such a way that the total group of the strings equals the total length of the string. | |
* Each alphabets should be unique in the group as well. | |
*/ | |
const Alphabets = "abcdefghijklmnopqrstuvwxyz"; | |
/** | |
* Use recursion to solve | |
* @param {string} input |
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 leftRotations(a = [], d = 5) { | |
const input = a; | |
const arrayLength = input.length; | |
const rotation = d; | |
for (let index = 0; index < arrayLength; index++) { | |
if ((index + 1) <= rotation) { | |
let arrayIndex = input.shift(); | |
input.push(arrayIndex); | |
} else { |
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
/** | |
* Determine the number of stairs to print | |
* The default stair has to have at least 1 space from the left | |
* Other stairs should inherit the same syntax except the last one | |
* | |
* First thing I had to do was initalize an empty stairs. | |
* Create a loop based on the stairCaseLength Param. | |
* Initialize two indexes. (One to handle the loop from 0 - stairCaseLength)(i) and the other to (decrement the stairCaseLength)(j) | |
* For each case to be printed to the console, I had to use the .repeat method with (j - 1) to print the number of spaces the stairs(#)(i) should have. This would in turn make sure that the last stair to be printed has no spacing. | |
* The stairs denoted by (#) are also printed out using the repeat method and it takes the (i + 1) as a param. |
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
/** | |
* This function takes a string and limits it from the bottom based on the output length. | |
* | |
* The following strings are invalid as answers "Codility we test code": This is because we need to return coders instead. | |
* The string output should not be less than the output length as well. | |
* The string can return an empty string as an answer too, | |
* | |
* @param {string} message | |
* @param {number} outputLength | |
* @returns {string} |
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 DiagonalDifference(InputArray) { | |
const Input = InputArray | |
/** | |
* Determine the matrix type [3,3] || [4,4] | |
* Validate the matrix is in the desired order. | |
* Confirm that all the sub-array has the required length. | |
* Pick the most common length from the array and remove the sub-arrays that don't match. | |
*/ | |
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
/** | |
* | |
1. Build a function to accept the string as an arguement. | |
2. Capture the length of the string. | |
3. Determine that the string length is an even number. This would provide certainty that the brackets are even. | |
4. Write a loop based on the length of the string but divided. | |
5. Inside the loop, take the current index of the string and the inverse index of the string based on the loop index. | |
6. Concat the string and look for a match. | |
7. Push the results into an array and filter out negative values. | |
**/ |
NewerOlder