Bosnians Who Design is a directory of accomplished Bosnians and Herzegovinians in the IT industry.
git clone https://github.com/malcodeman/bosnianswho.design
cd bosnianswho.design
yarn install
yarn dev
.env.development.local:
TWITTER_TOKEN=token
Before running
yarn out
yarn serve
you need to remove i18n
property from the next.config.js
file because internationalized routing does not integrate with next export.
const followings = await listTwitterFollowings();
We run GET /2/users/:id/following endpoint to get a list of users the @bosniansdesign is following.
const usernames = splitEvery(
100,
map((item) => item.username, followings)
);
We split usernames into slices of 100 items each because of the GET /2/users/by
endpoint usernames query parameter limit.
async function getTwitterDesigners(
usernames: string[][],
index: number,
designers = []
): Promise<TwitterDesigner[]> {
if (equals(index, length(usernames))) {
return designers;
}
return getTwitterDesigners(
usernames,
inc(index),
concat(await listTwitterDesigners(usernames[index]), designers)
);
}
const twitterDesigners = await getTwitterDesigners(usernames, 0, []);
We run GET /2/users/by endpoint to get created_at,location,url,description,verified,profile_image_url,entities
information about users specified by their usernames.
const designers = map((item) => {
const description = split(" ", toLower(item.description));
const positions = flatten(map((item) => item.value, constants.POSITIONS));
const inter = intersection(description, positions);
return {
...item,
position: inter,
};
}, twitterDesigners);
We map twitter users to assign appropriate positions based on twitter description.
const positions = map((position) => {
return {
...position,
count: count(
(designer) =>
any((item) => includes(item, position.value), designer.position),
designers
),
};
}, constants.POSITIONS);
We map initial positions and run count function for every designer position.