Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git/
.github/
screenshots/
README.md
10 changes: 0 additions & 10 deletions .pre-commit-config.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions .sqlfluff

This file was deleted.

27 changes: 11 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# GitHub Blueprint
# Nearest Earthquake — Screenly Edge App

Blueprint for GitHub repos.
Shows the single nearest earthquake to this screen and how far away it is.

## Usage
Two files: `screenly.yml` and `index.html`. No stylesheet, no libraries, no
settings. Distances in kilometres. Data from the public USGS feed (all magnitudes,
past 24 hours), refreshed every 5 minutes.

```bash
$ rsync -aP .github /path/to/repo/
```

## Repo Configuration
Needs a player: it reads the screen's coordinates and the CORS proxy from the
injected `screenly.js` bridge, so it will not run in a plain browser.

* Default branch should be `master`
* If relevant, `production` is used as the production branc h
* Branch protection should be enabled on master and production with:
* `Require a pull request before merging`, `Require approvals` and `Require review from Code Owners`
* `Require status checks to pass before merging`
## Deploy

## Code Owner

Adjust `.github/CODEOWNERS` to the squad that owns the repo.
```bash
screenly edge-app deploy
```
32 changes: 32 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<h1 id=out></h1>
<script src="screenly.js?version=1"></script>
<script>
var here = screenly.metadata.coordinates;
var url = screenly.cors_proxy_url + "/https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson";

function kmAway(quake) {
var rad = Math.PI / 180;
var lat1 = here[0] * rad;
var lat2 = quake.geometry.coordinates[1] * rad;
var dLat = lat2 - lat1;
var dLng = (quake.geometry.coordinates[0] - here[1]) * rad;
var h = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(lat1) * Math.cos(lat2) * Math.sin(dLng / 2) * Math.sin(dLng / 2);
return 12742 * Math.asin(Math.sqrt(h));
}

function show() {
fetch(url).then(response => response.json()).then(feed => {
var nearest = feed.features[0];
feed.features.forEach(quake => {
if (kmAway(quake) < kmAway(nearest)) nearest = quake;
});
out.textContent = "M" + nearest.properties.mag + " " + nearest.properties.place +
" - " + Math.round(kmAway(nearest)) + " km away";
});
setTimeout(show, 300000);
}

show();
</script>
12 changes: 0 additions & 12 deletions pyrightconfig.json

This file was deleted.

57 changes: 0 additions & 57 deletions ruff.toml

This file was deleted.

11 changes: 11 additions & 0 deletions screenly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
syntax: manifest_v1
id: 01KZ77RN8V1GWCGTYG53HP1V0T
description: Shows the nearest earthquake to this screen and how far away it is.
author: Will Cornforth
homepage_url: https://earthquake.usgs.gov
categories:
- Dashboards
entrypoint:
type: file
ready_signal: false
Loading