Skip to content
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

[ImgBot] Optimize images #844

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
659 changes: 638 additions & 21 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"helmet": "^4.6.0",
"immer": "^9.0.6",
"jsdom": "^16.4.0",
"jszip": "^3.6.0",
"mongodb": "^3.6.3",
"mongodb-memory-server": "^6.9.2",
"node-fetch": "^2.6.5",
Expand Down
Binary file modified pics/vaken-org.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pics/vaken-sponsor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pics/vaken1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 41 additions & 1 deletion scripts/populateDb.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ObjectID } from 'mongodb';
import faker from 'faker';
import { config as dotenvConfig } from 'dotenv';
import { Storage } from '@google-cloud/storage';
import institutions from '../src/client/assets/data/institutions.json';
import {
ApplicationStatus,
Expand All @@ -12,10 +13,22 @@ import {
HackerDbObject,
} from '../src/server/generated/graphql';
import DB from '../src/server/models';
import { RESUME_DUMP_NAME } from '../src/client/assets/strings.json';

dotenvConfig();

const NUM_HACKERS = 800;
const printUsage = (): void => {
void console.log('Usage: INCLUDE_RESUMES=[true | false] ts-node ./scripts/downloadResumes.ts');
};

const { INCLUDE_RESUMES } = process.env;
if (!INCLUDE_RESUMES) {
printUsage();
process.exit(1);
}
const includeResumes = INCLUDE_RESUMES === 'true';

const NUM_HACKERS = 200;

const generateHacker: () => HackerDbObject = () => {
const fn = faker.name.firstName();
Expand Down Expand Up @@ -59,6 +72,33 @@ const addHackers = async (): Promise<void> => {
console.log(`Adding the hackers to the DB...`);
const { insertedCount } = await models.Hackers.insertMany(newHackers);
console.log(`Inserted ${insertedCount} new hackers`);
if (includeResumes) {
console.log('Uploading resumes...');
const bucket = new Storage(JSON.parse(process.env.GCP_STORAGE_SERVICE_ACCOUNT ?? '')).bucket(
process.env.BUCKET_NAME ?? ''
);

await bucket.file(RESUME_DUMP_NAME).delete({ ignoreNotFound: true });

await Promise.all(
newHackers.map(async hacker => {
const id = hacker._id.toHexString();
try {
const contents = `Filler resume for ${hacker.firstName} ${hacker.lastName}.`;
await bucket.file(id).save(contents, {
resumable: false,
validation: false,
});
console.log(contents);
} catch (e) {
console.group('Error:');
console.error(e);
console.info('Hacker ID:', hacker._id);
console.groupEnd();
}
})
);
}
process.exit(0);
};

Expand Down
2 changes: 1 addition & 1 deletion src/client/assets/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const questions = [
{
Component: FileInput,
fieldName: 'resume',
note: 'Your résumé will be shared with sponsors',
note: '(pdf only) Your resume will be shared with sponsors',
title: 'Résumé',
},
{
Expand Down
Binary file modified src/client/assets/img/VH_Space_Logo_Black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/client/assets/img/VH_Space_Logo_White.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
203 changes: 1 addition & 202 deletions src/client/assets/img/application_status.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions src/client/assets/img/back.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 1 addition & 30 deletions src/client/assets/img/checked_box.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions src/client/assets/img/down_arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions src/client/assets/img/email_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions src/client/assets/img/github_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/client/assets/img/google_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions src/client/assets/img/lock_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading