This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/). |