Skip to content

AlexDjangoX #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
22e5dfd
Solution 1
AlexDjangoX Jul 3, 2022
85d95da
Merge branch 'boolean-uk:main' into main
AlexDjangoX Jul 18, 2022
4c4dfa9
3-test-js-grad
AlexDjangoX Jul 19, 2022
74c46db
REDONE: 3-test-js-grad
AlexDjangoX Jul 20, 2022
ff1da7f
REDONE: 1-reading-writing-files
AlexDjangoX Jul 20, 2022
3331d8d
2-coding-test: longest-sequence.js
AlexDjangoX Jul 20, 2022
d9b5caa
test
AlexDjangoX Jul 20, 2022
0825030
added answer.txt
AlexDjangoX Jul 20, 2022
8036094
longest sequence spec
AlexDjangoX Jul 20, 2022
58b8efc
could not fix linting problems
AlexDjangoX Jul 20, 2022
0244e02
Merge branch 'boolean-uk:main' into main
AlexDjangoX Jul 20, 2022
9cbe4e5
Merge branch 'boolean-uk:main' into main
AlexDjangoX Jan 12, 2023
528fa89
Merge remote-tracking branch 'upstream/main'
AlexDjangoX Jan 12, 2023
cf19777
6-fullstack-upstream initial
AlexDjangoX Jan 12, 2023
e8c7e2a
Merge branch 'main' of github.com:AlexDjangoX/developer-process-works…
AlexDjangoX Jan 12, 2023
9bb194f
scr/components/PlaceDetails.js
AlexDjangoX Jan 12, 2023
06b60ae
6-fullstack-upstream solution
AlexDjangoX Jan 15, 2023
4539847
tidied up
AlexDjangoX Jan 18, 2023
fa36298
Merge remote-tracking branch 'upstream/main'
AlexDjangoX Jan 23, 2023
2e86b9b
7-luma-fe initial set up, initial components - LandingPage.js, Referr…
AlexDjangoX Jan 23, 2023
05cfac2
added Montserrat font in index.html, added color-pallete in App.css
AlexDjangoX Jan 23, 2023
bf831c9
added AccordionComponent.js
AlexDjangoX Jan 24, 2023
0383e26
FormInput.js component complete, need to add logic, tweak styles
AlexDjangoX Jan 24, 2023
9007a22
FormInput.js component using Formik added
AlexDjangoX Jan 25, 2023
29cdef0
ReferralForm.js and components complete. Set up JSON-server
AlexDjangoX Jan 25, 2023
f1509f6
styled form
AlexDjangoX Jan 28, 2023
e3a9b6d
working solution, needs tweaking
AlexDjangoX Jan 28, 2023
147922d
implemented PlaceAutoComplete in FormInput.js
AlexDjangoX Jan 29, 2023
9ed4c8e
BUG FIX: implemented the AutoComplete
AlexDjangoX Jan 29, 2023
11903f6
BUG FIXES: passing object incorrectly in Formik onSubmit fuction. Cor…
AlexDjangoX Jan 30, 2023
d78bc66
Adding navigation between LandinGPage and ReferralPage
AlexDjangoX Jan 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions requirement-sets/1-reading-writing-files/answer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
count: 3
24 changes: 23 additions & 1 deletion requirement-sets/1-reading-writing-files/src/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
// run the program
const fs = require('fs');

const data = fs.readFileSync('../input.txt');
const dataArray = data.toString().toUpperCase().trim().split('\r\n');
console.log(dataArray);

function checkPosition(data) {
let count = 0;
dataArray.forEach((el) => {
const counts = { W: 0, E: 0, N: 0, S: 0 };
el.split('').forEach((letter) => (counts[letter] += 1));
if (counts.W === counts.E && counts.S === counts.N) count += 1;
});
const output = `count: ${count}`;
fs.writeFile('../answer.txt', output, (err) => {
if (err) {
console.error(err);
}
});
return count;
}

console.log(checkPosition(data));
14 changes: 6 additions & 8 deletions requirement-sets/2-coding-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ module.exports = {
env: {
commonjs: true,
es2021: true,
node: true
node: true,
jasmine: true,
},
extends: [
'standard'
],
extends: ['standard'],
parserOptions: {
ecmaVersion: 'latest'
ecmaVersion: 'latest',
},
rules: {
}
}
rules: {},
};
121 changes: 120 additions & 1 deletion requirement-sets/2-coding-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions requirement-sets/2-coding-tests/spec/longest-sequence.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const longestSequence = require('../src/longest-sequence.js')

describe('Longest sequence', () => {
it('sequence 1', () => {
expect(longestSequence('gggttrfdesdcxzzzzzzzzzz')).toEqual({ z: 10 })
})
it('sequence 2', () => {
expect(longestSequence('rrftghuuytredswwsdxxxxxxxxxxgftrgr')).toEqual({
x: 10
})
})
})
30 changes: 30 additions & 0 deletions requirement-sets/2-coding-tests/src/longest-sequence.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const longestSequence = (str) => {
let longestSequence = { a: 0 }
let currentSequence = {}

for (let i = 0; i < str.length - 1; i++) {
const char = str[i].toLowerCase()
const nextChar = str[i + 1].toLowerCase()

if (!currentSequence[char]) {
currentSequence = {}
currentSequence[char] = 1
}

if (char === nextChar) {
currentSequence[char] += 1
}
if (Object.values(currentSequence)[0] > Object.values(longestSequence)[0]) {
longestSequence = { ...currentSequence }
} else if (
Object.values(currentSequence)[0] === Object.values(longestSequence)[0]
) {
if (Object.keys(currentSequence)[0] < Object.keys(longestSequence)[0]) {
longestSequence = { ...currentSequence }
}
}
}
return longestSequence
}

module.exports = longestSequence
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,19 @@ GET https://api.npms.io/v2/search/suggestions?q=react

*/

const axios = require('axios');

module.exports = async function countMajorVersionsAbove10() {
// TODO
try {
const { data } = await axios.get(
'https://api.npms.io/v2/search/suggestions?q=react'
);
const answer = data
.map((el) => el.package.version.split('.')[0])
.filter((el) => Number(el) >= 10).length;

return number
return answer;
} catch (err) {
console.log(err);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,22 @@ GET https://api.npms.io/v2/search/suggestions?q=react
* the "name" of the package that has the oldest "date" value

*/
const axios = require('axios');

module.exports = async function oldestPackageName() {
// TODO
try {
const { data } = await axios.get(
'https://api.npms.io/v2/search/suggestions?q=react'
);

return name
const name = data
.map((el) => [el.package.date, el.package.name])
.reduce((previous, current) => {
return previous[0] < current[0] ? previous : current;
})[1];

return name;
} catch (err) {
console.log(err);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

* Make the following HTTP request with either axios or node-fetch:

/*

* Make the following HTTP request with either axios or node-fetch:

GET https://api.npms.io/v2/search/suggestions?q=react

******
Expand All @@ -23,8 +27,32 @@ GET https://api.npms.io/v2/search/suggestions?q=react

*/

module.exports = async function organiseMaintainers() {
// TODO
const axios = require('axios');

return maintainers
module.exports = async function organiseMaintainers() {
let maintainers = [];

const { data } = await axios.get(
'https://api.npms.io/v2/search/suggestions?q=react'
);

data.forEach((dep) => {
dep.package.maintainers.forEach((maintainer) => {
const record = maintainers.find((obj) => {
return obj.username === maintainer.username;
});
if (!record) {
const newRecord = {
username: maintainer.username,
packageNames: [dep.package.name],
};
maintainers.push(newRecord);
} else {
record.packageNames.push(dep.package.name);
}
});
});

// console.log('DATA : ', JSON.stringify(data[0], null, 2));
return maintainers;
};
Loading