GithubHelp home page GithubHelp logo

appleby / leetcode.el Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kaiwk/leetcode.el

0.0 0.0 0.0 2.16 MB

An Emacs LeetCode client.

License: GNU General Public License v3.0

Emacs Lisp 100.00%

leetcode.el's Introduction

MELPA

Introduction

LeetCode brings you offer, and now Emacs brings you LeetCode!

Usage

screencast

  1. Execute leetcode command, and in problem list buffer:
Keymap Description
o show current problem
O show problem by prompting problem id
v view the current problem
V view a problem by prompting problem id
b show the current problem in browser
B show a problem by problem id in browser
c start coding the current problem
C start coding a problem by problem id
s filter problems by regex
t filter problems by tag
T toggle tag display
d filter problems by difficulty
r reset filters
P toggle paid problems display
g (z for evil-mode) refresh without fetching from LeetCode
G (Z for evil-mode) refresh all problems
L change prefer language
RET show current problem
TAB view current problem
  1. Press <RET>, show problem detail, move cursor to "solve it", press <RET> again, start coding!

  2. After finishing your code, you can edit testcase and execute leetcode-try or execute leetcode-submit.

leetcode-submit

In leetcode-solution-mode, you will have:

Keymap Description
C-c C-t run code with testcase
C-c C-s submit
C-c C-r restore window layout

You can also disable IDE-like features by adding hook to leetcode-solution-mode-hook:

(add-hook 'leetcode-solution-mode-hook
          (lambda() (flycheck-mode -1)))

Installation

LeetCode do not allow third party login, one workaround is restore LeetCode session from local Firefox or Chrome cookies. By default, this package will install a Python3 package called my_cookies, or you can install it manually: pip3 install my_cookies.

Since we are using shr.el to render HTML, you may also want to look at shrface.

Manually

  1. Clone this repository and install all dependencies
  2. Move it to your load-path
  3. Require it in your emacs config

Configuration

You can set your preferred LeetCode programming language and SQL by setting leetcode-prefer-language and leetcode-prefer-sql:

If you prefer not to see problems' tags in the *leetcode**buffer by default. set leetcode-prefer-tag-display to nil

(setq leetcode-prefer-language "python3")
(setq leetcode-prefer-sql "mysql")

All supported languages can be found in variable leetcode--lang-suffixes.

You can save solution by setting leetcode-save-solutions:

(setq leetcode-save-solutions t)
(setq leetcode-directory "~/leetcode")

Work with Org Mode

leetcode-show-problem-by-slug will let you put to org files with a link in this format to show the question after the leetcode buffer is load like [elisp:(leetcode-show-problem-by-slug (leetcode--slugify-title "ZigZag Conversion"))]

Debug

Call leetcode-toggle-debug, log will output in *leetcode-log* buffer.

Contributing

Please submit PR to develop branch.

leetcode.el's People

Contributors

anlsh avatar chenleo92 avatar cnglen avatar deyuan avatar edmondfrank avatar elilif avatar elton2048 avatar kaiwk avatar limoiie avatar matthewzmd avatar mrunhap avatar noahdragon avatar nverno avatar specter119 avatar swapnilsm avatar zsxh avatar zzndb 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.