Skip to content

Commit

Permalink
feat(app): Add special heyho endpoint for showcasing
Browse files Browse the repository at this point in the history
This is excellent: it allows anyone to try out ancv immediately,
without me having to provide my own resume (which seems selfish).
This is a neutral sample. It can also serve as a starting point for constructing
a resume.

Let's hope the 'heyho' GitHub user doesn't fancy using ancv!
(that account is taken but completely empty as of right now)
  • Loading branch information
alexpovel committed Sep 5, 2022
1 parent 4b118ed commit 79f20b8
Show file tree
Hide file tree
Showing 5 changed files with 247 additions and 15 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,51 @@ Be warned though, for this is kinda useless and just for fun:

1. Create a resume according to the [JSON Resume Schema](https://jsonresume.org/schema/) (see also the [schema specification](https://github.com/jsonresume/resume-schema/blob/master/schema.json)) either:

- manually (see [this sample](./tests/test_data/resumes/full.json) for a possible starting point),
- manually (see [the `heyho` sample](./ancv/data/showcase.resume.json) for a possible starting point),
- exporting from [LinkedIn](https://www.linkedin.com/) using [Joshua Tzucker's LinkedIn exporter](https://joshuatz.com/projects/web-stuff/linkedin-profile-to-json-resume-exporter/) ([repo](https://github.com/joshuatz/linkedin-to-jsonresume)), or
- exporting from one of the platforms advertised as offering [JSON resume integration](https://jsonresume.org/schema/).
2. [Create a **public** gist](https://gist.github.com/) named `resume.json` with those resume contents.
See [here](https://gist.github.com/alexpovel/4a94aaccdc6ed8d214d0f8a73e50a536) for a working example from the author.
3. Try it out, using...
3. Try it out!
The following examples work out-of-the-box.
**Replace `heyho` with your GitHub username** when you're ready.

- curl:

```bash
curl -L ancv.io/username
curl -L ancv.io/heyho
```

with `-L` being shorthand for [`--location`](https://curl.se/docs/manpage.html), allowing you to follow the redirect from `http:https://ancv.io` through to `https://ancv.io`.
It's shorter than its also perfectly viable alternative:

```bash
curl https://ancv.io/username
curl https://ancv.io/heyho
```

Lastly, you might want to page the output for easiest reading, top-to-bottom:

```bash
curl -sL ancv.io/username | less
curl -sL ancv.io/heyho | less
```

If that garbles the rendered output, try `less -r` aka [`--raw-control-chars`](https://man7.org/linux/man-pages/man1/less.1.html).

- wget:

```bash
wget -O - --quiet ancv.io/username
wget -O - --quiet ancv.io/heyho
```

where `-O` is short for [`--output-document`](https://linux.die.net/man/1/wget), used here to redirect to stdout.

- PowerShell (5 and 7):

```powershell
(iwr ancv.io/username).Content
(iwr ancv.io/heyho).Content
```

where `iwr` is an alias for [`Invoke-Webrequest`](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.2), returning an object.

**For a quick, working example replace `username` with `alexpovel`.**

## Configuration

*All configuration is optional.*
Expand Down
210 changes: 210 additions & 0 deletions ancv/data/showcase.resume.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Jane A. Cooper",
"label": "Fullstack Developer",
"image": "http:https://example.com/jane.jpg",
"email": "[email protected]",
"phone": "+44 113 496 4389",
"url": "https://cooper.example.dev",
"summary": "Passionate and creative fullstack developer with over 7 years of experience in building and maintaining web applications. I have a strong background in JavaScript and PHP, and I am proficient in a variety of frameworks and libraries. I am also experienced in building and maintaining RESTful APIs.",
"location": {
"address": "1995 Little Acres Lane",
"postalCode": "CA 94115",
"city": "Carrollton",
"countryCode": "US",
"region": "Texas"
},
"profiles": [
{
"network": "Twitter",
"username": "janethecoopest",
"url": "https://twitter.com/janethecoopest"
},
{
"network": "LinkedIn",
"username": "jane-a-cooper",
"url": "https://linkedin.com/jane-a-cooper"
},
{
"network": "GitHub",
"username": "janec",
"url": "https://github.com/janec"
}
]
},
"work": [
{
"name": "Google Inc.",
"location": "San Francisco, CA",
"description": "Internal tools and services.",
"position": "Software Engineer III",
"url": "https://google.com",
"startDate": "2016-03-30",
"summary": "Work included Borg (Google's internal cluster management system), Google's internal build system, and Google's internal continuous integration system.",
"highlights": [
"Wrote a new build system for Google's internal continuous integration system.",
"Improved performance of Google's internal Borg deployment by 18%."
]
}
],
"education": [
{
"institution": "Massachusets Institute of Technology",
"url": "https://www.mit.edu/",
"area": "Computer Science (Distributed Systems)",
"studyType": "Bachelor of Science",
"startDate": "2012-10-01",
"endDate": "2016-01-01",
"score": "3.91",
"courses": [
"6.1600: Foundations of Computer Security",
"6.1810: Operating System Engineering",
"6.1820: Mobile and Sensor Computing",
"6.5831: Database Systems"
]
}
],
"certificates": [
{
"name": "Google Certified Professional Cloud Architect",
"issuer": "Google",
"date": "2019-02-01",
"url": "https://cloud.google.com/certification/cloud-architect",
"summary": "Demonstrated proficiency in designing, developing, managing, and monitoring cloud-based applications and infrastructure."
}
],
"awards": [
{
"title": "Google Code-in Finalist 🏆",
"date": "2011-12-01",
"awarder": "Google",
"summary": "Finalist for Google Code-in, a global contest for pre-university students to introduce them to open source software development."
}
],
"interests": [
{
"name": "Open Source",
"keywords": [
"Software Development",
"Linux",
"Maintenance"
]
},
{
"name": "Music",
"keywords": [
"Guitar",
"Folk Rock"
]
}
],
"languages": [
{
"language": "English",
"fluency": "Native speaker"
},
{
"language": "Spanish",
"fluency": "Professional working proficiency"
}
],
"projects": [
{
"name": "AWS Benchmarking Tool",
"description": "A tool for benchmarking the performance of various AWS services, including EC2, S3, and Lambda. Written in Python.",
"url": "https://github.com/janec/aws-benchmarking-tool",
"highlights": [
"100% code coverage and fully typed",
"Can run as a CLI or as a web service, with OpenAPI documentation",
"Full support for parallel execution"
],
"keywords": [
"AWS",
"Benchmarking",
"Python",
"Infrastructure"
],
"startDate": "2015-11-30"
}
],
"publications": [
{
"name": "Modern Approaches to Distributed Systems",
"publisher": "MIT Press",
"releaseDate": "2015-12-01",
"url": "https://mitpress.mit.edu/books/new-approach-distributed-systems",
"summary": "A comprehensive literature overview to distributed systems, with a focus on the practical aspects of building and maintenance."
}
],
"references": [
{
"name": "Tom T. Baker",
"reference": "Jane is a very talented developer and lovely teammate. They are a pleasure to work with, and I would recommend them to any company."
}
],
"skills": [
{
"name": "Web Development",
"level": "Expert",
"keywords": [
"HTML",
"CSS",
"JavaScript (ES6+)",
"PHP"
]
},
{
"name": "Python",
"level": "Proficient",
"keywords": [
"Django",
"Flask",
"Pyramid"
]
},
{
"name": "Databases",
"level": "Intermediate",
"keywords": [
"PostgreSQL",
"MySQL",
"MongoDB"
]
},
{
"name": "Cloud",
"level": "Expert",
"keywords": [
"AWS",
"Google Cloud",
"Azure"
]
}
],
"volunteer": [
{
"organization": "Shelter for Homeless Cats",
"position": "Volunteer",
"url": "https://example.com/catshelter",
"startDate": "2009-07-01",
"endDate": "2019-06-01",
"summary": "Provided food and shelter for homeless cats.",
"highlights": [
"Cared for 20 cats",
"Raised $3400 for food and supplies",
"Organized adoption events"
]
}
],
"meta": {
"version": "v1.0.0",
"canonical": "https://github.com/jsonresume/resume-schema/blob/v1.0.0/schema.json",
"ancv": {
"template": "Sequential",
"theme": "basic",
"ascii_only": false,
"language": "en"
}
}
}
10 changes: 10 additions & 0 deletions ancv/web/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from gidgethub.aiohttp import GitHubAPI
from structlog import get_logger

from ancv import PROJECT_ROOT
from ancv.data.validation import is_valid_github_username
from ancv.exceptions import ResumeConfigError, ResumeLookupError
from ancv.timing import Stopwatch
Expand All @@ -19,6 +20,12 @@

LOGGER = get_logger()

_SHOWCASE_RESUME = Template.from_file(
PROJECT_ROOT / "data" / "showcase.resume.json"
).render()

_SHOWCASE_USERNAME = "heyho"


@dataclass
class ServerContext:
Expand Down Expand Up @@ -124,6 +131,9 @@ async def username(self, request: web.Request) -> web.Response:

user = request.match_info["username"]

if user == _SHOWCASE_USERNAME:
return web.Response(text=_SHOWCASE_RESUME)

if not is_valid_github_username(user):
raise web.HTTPBadRequest(reason=f"Invalid username: {user}")

Expand Down
8 changes: 4 additions & 4 deletions docs/images/concept-flow-chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion tests/web/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from aiohttp.client import ClientResponse
from aiohttp.web import Application

from ancv.web.server import server_timing_header
from ancv.web.server import _SHOWCASE_RESUME, _SHOWCASE_USERNAME, server_timing_header
from tests import gh_rate_limited


Expand Down Expand Up @@ -103,6 +103,18 @@ async def test_username_endpoint(
if expected_error_message is not None:
assert await resp.text() == expected_error_message

async def test_showcase_endpoint(
self,
aiohttp_client: Any,
api_client_app: Application,
event_loop: Any,
) -> None:
client = await aiohttp_client(api_client_app)

resp: ClientResponse = await client.get(f"/{_SHOWCASE_USERNAME}")
assert resp.status == HTTPStatus.OK
assert await resp.text() == _SHOWCASE_RESUME

@pytest.mark.parametrize(
["username", "expected_contained_text"],
[
Expand Down

0 comments on commit 79f20b8

Please sign in to comment.