Skip to content

Instantly share code, notes, and snippets.

View novaugust's full-sized avatar

Matt Enlow novaugust

View GitHub Profile
@novaugust
novaugust / insta_2_json.exs
Last active December 21, 2022 16:05
instagram to ghost scripts
Mix.install [:floki, :jason]
defmodule InstaDumpParser do
def parse_url(url) do
# ghost uploads to this, keeping filename:
# https://blog.novaugust.net/content/images/2022/12/10616813_1695162544038552_1763391856_n_17841611368072760.jpg
[year, month, filename] = Regex.run(~r|media/posts/(\d\d\d\d)(\d\d)/(.*)|, url, capture: :all_but_first)
%{year: year, month: month, filename: filename}
end
@novaugust
novaugust / 1_rewriting_a_codebase_with_sourceror.exs
Last active March 1, 2023 21:35
Credo Rewrites Via Sourceror
# for an example of a suggested `locals_without_parens`, see z_locals_without_parens.exs
# parsing and expanding a formatter.exs file would be a good route too
opts = [sourceror_opts: [locals_without_parens: [...], line_length: 122]]
for transformation <- [&PipeChainStart.run/1, &SinglePipe.run/1] do
ProjTraversal.transform("../my_codebase/", transformation, opts)
end
@novaugust
novaugust / Adding Disqus to a ghost blog on casper ~ 1.0
Last active October 9, 2023 14:12
Adding Disqus to a Ghost Blog running a Casper-based theme without editing any files
I noticed that there weren't any writeups for using code injection to add Disqus comments to a ghost blog. Everything assumes you're comfortable with editing your theme (and thus being responsible for maintaining a fork, urk).
So, I used the steps below to add to Disqus comments to my blog running a [Casper fork](https://github.com/novaugust/novasper). If your theme varies wildly from Casper, you'll be able to get by just by updating the css selectors in the javascript. If all that is a bit much for you, leave a comment and a link to your site and I'll give you what your versino of the code would be.
## Code Injection to the rescue
So! Here's the scoop
1. **Set up your disqus**. You're a grownup, you'll figure it out.
2. Go to your blog admin's **`Code Injection`** section (example.com/ghost/settings/code-injection/).