Giter Club home page Giter Club logo

roguh / code-golf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from code-golf/code-golf

0.0 0.0 0.0 12.34 MB

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

Home Page: https://code.golf

License: MIT License

Shell 0.81% JavaScript 0.03% C++ 0.03% Perl 0.14% C 4.54% Go 43.87% C# 1.49% F# 0.31% Nim 0.06% TypeScript 10.57% CSS 7.10% Makefile 0.46% HTML 9.32% PLpgSQL 1.97% Dockerfile 9.22% Raku 10.09%

code-golf's Introduction

Code Golf

This is the repository behind the website and community 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:

NOTE: if your host OS is not the same architecture / executable format as your Docker environment, this can result in incorrect format binaries installed into node_modules, so you may want to skip this step.

$ 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 .

TypeScript

The js/ directory contains the TypeScript files which will be transpiled by esbuild into JavaScript files for serving. .tsx files can additionally make use of JSX.

Linting

Run make lint to lint the code before a pull request. This lints the TypeScript code, then the Go code.

In Visual Studio Code, the following settings are helpful for editor support for ESLint:

"eslint.validate": ["typescript", "typescriptreact"],
"eslint.format.enable": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"

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

API

Validate API definition with vacuum.

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.).

code-golf's People

Contributors

jraspass avatar sirbogman avatar michalmarsalek avatar alemelis avatar jared-hughes avatar stefangimmillaro avatar btnlq avatar mewheni avatar lynn avatar newdefectus avatar ian-h-chamberlain avatar kg583 avatar prplz avatar jayxon avatar grayjoking avatar commandblockguy avatar lydxn avatar andre-lameirinhas avatar sisyphus-ppcg avatar primo-ppcg avatar steffan153 avatar irratix avatar edre avatar yewzir avatar akshatj27 avatar dependabot[bot] avatar defterade avatar tfeld00 avatar andriamanitra avatar m-ender avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.