Skip to content

A game designed to let you show off your code-fu by solving problems in the least number of characters.

License

Notifications You must be signed in to change notification settings

KrausRaus/code-golf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Golf

This is the repository behind https://code.golf

Quickstart

Alternatively, see the Vagrant section below to create a virtual machine with everything pre-installed.

  1. Install dependencies:
  1. Install the local CA:
$ make cert
Using the local CA at "~/.local/share/mkcert" ✨
The local CA is now installed in the system trust store! ⚡️
The local CA is now installed in the Firefox and/or Chrome/Chromium trust store (requires browser restart)! 🦊


Created a new certificate valid for the following names 📜
 - "localhost"

The certificate is at "./localhost.pem" and the key at "./localhost-key.pem" ✅
  1. Install the NPM packages:
$ npm install
  1. Bring up the website:
$ make dev
  1. Optionally, load information from the code.golf database.
$ go run utils/update_sql_from_api.go
  1. Navigate to https://localhost

Hacking

Some of ancillary scripts are written in Raku, to run these ensure you have a recent install of Raku installed and use Zef to install the dependencies:

$ zef install --deps-only .

Testing

  1. Run the unit tests:
$ make test
  1. Run the e2e tests:
$ make e2e

Vagrant

Using Vagrant and VirtualBox, with one command you can create a virtual machine, install all of the other dependencies onto it (Docker, Docker Compose, Go, Raku + zef dependencies, npm, etc.), and forward port 443 (https) to it.

  1. Install the dependencies:

If you have homebrew, you can install with:

$ brew install vagrant virtualbox
  1. Create the virtual machine:
$ vagrant up
  1. Install certificates. Ideally, you should run the following command outside of the virtual machine, the same as in the quickstart, because it will install the certificate in your browser. Alternatively, you can run the command in a virtual machine shell and then install the certificates manually.
$ make cert

or

$ vagrant ssh --command 'cd /vagrant/ && make cert'
  1. Bring up the website:
$ vagrant ssh --command 'cd /vagrant/ && make dev'
  1. Optionally, load information from the code.golf database.
$ vagrant ssh --command 'cd /vagrant/ && go run utils/update_sql_from_api.go'
  1. Navigate to https://localhost

Database Access

If you have PostgreSQL installed You can access the SQL database directly with the following command. If you are using Vagrant, PostgreSQL is pre-installed.

$ make db-dev

Style

URL slugs are consistently abbreviated (e.g. cheevos, langs, stats) but page titles aren't (e.g. Achievements, Languages, Statistics).

Paginated URLs use a trailing number but only on pages after the first (e.g. /rankings/medals/all, /rankings/medals/all/2, etc.).

About

A game designed to let you show off your code-fu by solving problems in the least number of characters.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 38.8%
  • Raku 12.8%
  • HTML 11.5%
  • Dockerfile 9.7%
  • JavaScript 9.3%
  • CSS 8.0%
  • Other 9.9%