{"id":20836334,"url":"https://github.com/igrigorik/vimgolf","last_synced_at":"2025-05-14T15:07:09.796Z","repository":{"id":1263249,"uuid":"1202185","full_name":"igrigorik/vimgolf","owner":"igrigorik","description":"Real Vim ninjas count every keystroke - do you?","archived":false,"fork":false,"pushed_at":"2024-07-04T00:10:04.000Z","size":716,"stargazers_count":710,"open_issues_count":36,"forks_count":63,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-15T01:56:48.684Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.vimgolf.com/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igrigorik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2010-12-28T04:19:25.000Z","updated_at":"2025-04-14T21:36:16.000Z","dependencies_parsed_at":"2023-07-05T20:02:13.010Z","dependency_job_id":"5dfdbda3-4579-4ad8-ba8b-8c48ccb47a65","html_url":"https://github.com/igrigorik/vimgolf","commit_stats":{"total_commits":424,"total_committers":34,"mean_commits":"12.470588235294118","dds":0.8018867924528301,"last_synced_commit":"77c370dc2cf840025847f0974459db6588628298"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Fvimgolf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Fvimgolf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Fvimgolf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Fvimgolf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igrigorik","download_url":"https://codeload.github.com/igrigorik/vimgolf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254169473,"owners_count":22026212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T00:29:38.073Z","updated_at":"2025-05-14T15:07:09.757Z","avatar_url":"https://github.com/igrigorik.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# [VimGolf.com](http://www.vimgolf.com)\n\n[![Build Status](https://travis-ci.org/igrigorik/vimgolf.svg?branch=master)](https://travis-ci.org/igrigorik/vimgolf) [![Code Climate](https://codeclimate.com/github/igrigorik/vimgolf/badges/gpa.svg)](https://codeclimate.com/github/igrigorik/vimgolf) [![Issue Count](https://codeclimate.com/github/igrigorik/vimgolf/badges/issue_count.svg)](https://codeclimate.com/github/igrigorik/vimgolf)\n\nReal Vim ninjas count every keystroke - do you? Head on over to vimgolf.com, pick a challenge, and show us what you've got!\n\n* Each challenge provides an input file, and an output file\n* Your goal is to modify the input file such that it matches the output\n* Once you install the vimgolf CLI, pick a challenge, open a prompt and put away!\n\nWhen you launch a challenge from the command line, it will be downloaded from the site and a local Vim session will be launched, which will log every keystroke you make. Once you're done, simply *:wq* (write and quit) the session and we will score your input and upload it back to the site!\n\n## Setup \u0026 Play\n\n```bash\n$\u003e gem install vimgolf\n\n(Go to vimgolf.com, sign in, and grab your API key)\n$\u003e vimgolf setup\n\n(Pick a challenge on vimgolf.com)\n$\u003e vimgolf put [challenge ID]\n```\n\n## Golfing without ruby installation: [use docker](https://github.com/filbranden/vimgolf/pkgs/container/vimgolf)\n\n```\n$\u003e docker run --rm -it -e \"key=YOUR_VIMGOLF_KEY\" ghcr.io/filbranden/vimgolf challenge_ID\n```\n\n# Playing from other editors\n\n## Emacs\n\nThere's a lightly maintained interface to play VimGolf challenges in Emacs\nover at [vimgolf.el](https://github.com/timvisher/vimgolf.el)\n\n# VimGolf.com web app\n\n```bash\n# start local server\n$\u003e bundle exec unicorn -c config/unicorn.rb -E development\n\n# deploy to Heroku\n$\u003e git push heroku master\n```\n\n## Run tests\n\nGo to the root folder and run `bundle exec rake`.\n\n# How to contribute\n\nThis part is for people not familliar with ruby ecosystem\n\n## Installation\n\nYou need:\n- ruby\n- gem bundler\n- sqlite3 (library version 3.25 or newer, on your local system); or\n- postgresql\n\n### ruby\n\nYou need a ruby version, same as .ruby-version\n\nI recommend using rbenv, see https://github.com/rbenv/rbenv to install and manage ruby version.\n\n```\ncd $VIMGOLF_PATH\nrbenv install\n```\n\n### bundler\n\nBundler is a gem that aim to manage gem per project.\n\n```\ngem install bundler:1.17.2\n```\n\nThen you need all gems for the apps\n\n```\nbundle install\n```\n\n## Using sqlite3 for development (and testing)\n\nIt is possible to get a fully functionnal app running locally using SQLite3 only. This is the default adapter for development and testing (it makes for easier ramp up, since you don't need to set up an instance of Postgres and create the appropriate users.)\n\nNote that due to the use of SQL window functions, you need an SQLite3 library version 3.25 or newer installed on your system. The Ruby gem will use the locally installed library, so that is a pre-requisite to using SQLite3. The SQLite3 library shipped on Ubuntu 18.04 is too old, the one on Ubuntu 20.04 is new enough.\n\n## Using Postgres for development\n\nYou can also use a Postgres database for development (and testing.)\n\nInstall and start a Postgres instance running locally on your development host.\n\nThe app will run under your user, so create a Postgres user with the same name as your local user and give that user the ability to create databases. This is usually accomplished with the following command:\n\n```\nsudo -u postgres createuser -d $(whoami)\n```\n\nWhen running any of the Ruby and Rails code, in order to use the Postgres adapter in the development and test environments, export environment variable `DATABASE_ADAPTER=pg`.\n\nThe database names configured will be `vimgolf_development` and `vimgolf_test` for the respective environments.\n\n## Seed database\n\nRead db/seeds.rb to understand parameters to define how many users, challenges and entries to create.\n\nWhen creating a local development database on SQLite3 (the default adapter), use the following procedure:\n\n```\n# make the index page works - create collection \"challenges\"\nbundle exec rails db:drop db:setup\n\n# or add many challenges users and entries\nbundle exec rails db:drop db:setup challenges=40 users=30 entries=20\n```\n\nWhen creating a local development database on Postgres, **do not use** the `db:setup` and `db:reset` targets, as those targets rely on loading the `db/schema.rb` file, but that file contains a schema dump compatible with the SQLite3 database and would possibly produce a broken setup under Postgres. Instead, use `db:migrate` and `db:migrate:reset` to create the database running through the Rails migrations as appropriate.\n\n```\n# under postgres\nDATABASE_ADAPTER=pg bundle exec rails db:migrate:reset\nDATABASE_ADAPTER=pg bundle exec rails db:seed challenges=40 users=30 entries=20\n```\n\n## Run the app\n\nStart the server:\n\n```\nbundle exec unicorn -c config/unicorn.rb -E development\n```\n\n(If using Postgres, make sure you're passing it `DATABASE_ADAPTER=pg` through the environment.)\n\nOpen your browser to [localhost:8080](http://localhost:8080/).\n\nYou can check the Rails logs under:\n\n```\ntail -f log/development.log\n```\n\n## Logged in user under Development\n\nWhen click on 'Sign In with Twitter' under development, you will almost certainly get:\n\n```\nOAuth::Unauthorized\n401 Authorization Required\n```\n\nAs a workaround, you can edit file `app/controllers/application_controller.rb` and replace:\n\n```ruby\n    @current_user ||= User.where(uid: session[:user]).first if session[:user]\n```\n\nWith:\n\n```ruby\n    @current_user ||= User.first\n```\n\nOr, if you have a particular user in mind:\n\n```ruby\n    @current_user ||= User.find_by_nickname('myuser')\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figrigorik%2Fvimgolf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figrigorik%2Fvimgolf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figrigorik%2Fvimgolf/lists"}