Skip to content

Instantly share code, notes, and snippets.

@peterkeen
Last active December 20, 2022 20:29
Show Gist options
  • Save peterkeen/aa8449ff0acfc758b21943f227f8b2bd to your computer and use it in GitHub Desktop.
Save peterkeen/aa8449ff0acfc758b21943f227f8b2bd to your computer and use it in GitHub Desktop.
# Step 1: write a gist with a file named __script__.rb
# Step 2: copy and paste the function def below into Rails console
# Step 3: run `eval_gist("the-gist-id-from-the-url")`
# Step 4: GOTO Step 3
def eval_gist(gist_id)
eval(JSON.parse(Net::HTTP.get(URI("https://api.github.com/gists/#{gist_id}"))).dig("files", "__script__.rb", "content"))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment