Skip to content

Instantly share code, notes, and snippets.

View lkarthee's full-sized avatar

Kartheek L lkarthee

  • 11:38 (UTC +05:30)
View GitHub Profile
@lkarthee
lkarthee / phx.routes_check.ex
Last active March 5, 2022 07:22
mix phx.routes_check - Before you use this - code should be placed in <project_root>/lib/mix/tasks/phx.routes_check.ex
defmodule Mix.Tasks.Phx.RoutesCheck do
use Mix.Task
@shortdoc "Checks all routes for undefined modules and functions."
@version 1
# Code modified from
# phx.routes.ex -https://github.com/phoenixframework/phoenix/blob/22a71bd339783aa08a727b24ef8822fc5d66a511/lib/mix/tasks/phx.routes.ex#L1)
# console_formatter.ex - https://github.com/phoenixframework/phoenix/blob/22a71bd339783aa08a727b24ef8822fc5d66a511/lib/phoenix/router/console_formatter.ex#L1
@lkarthee
lkarthee / dragon_pyg.py
Last active April 15, 2021 17:14
Static Code Formatting for Dragon Ruby Docs
from bs4 import BeautifulSoup
from pygments import highlight
from pygments.lexers import RubyLexer
from pygments.formatters import HtmlFormatter
if __name__ == "__main__":
with open("pyg.html") as fp:
soup = BeautifulSoup(fp, 'html.parser')
code_tags = soup.find_all('code', class_="language-ruby")
for code_tag in code_tags: