Skip to content

Instantly share code, notes, and snippets.

@stilist
stilist / monkeypatch.diff
Created July 10, 2024 18:31
Monkeypatch relations into Publify Blog model
diff --git a/config/initializers/model_extensions.rb b/config/initializers/model_extensions.rb
new file mode 100644
index 000000000..2db532ba9
--- /dev/null
+++ b/config/initializers/model_extensions.rb
@@ -0,0 +1 @@
+require "blog_extension"
diff --git a/lib/blog_extension.rb b/lib/blog_extension.rb
new file mode 100644
index 000000000..01fbcf5b3
@stilist
stilist / day1.rb
Last active December 4, 2024 02:24
Advent of Code 2024
File.read(File.expand_path('~/Downloads/day 1 input.txt'))
.split(/\n/)
.reduce([]) {|m,l|l.split.map(&:to_i).each_with_index.map {(m[_2]||[])<<_1}}
.map(&:sort)
.each_cons(2)
.map {_1.zip(_2)}
.flatten(1)
.map {(_1-_2).abs}
.sum
@stilist
stilist / 0 README.markdown
Last active January 13, 2026 07:43
Extracting mood.camera’s film emulations

I like the look of mood.camera’s high-contrast black & white preset (the ‘Noir 800-C’ film stock), and would like to use it in other photo apps. Unlike most photo editors or camera apps with customizable looks, mood.camera doesn’t support LUT imports:

Why can't I import custom presets, instead of manually dialing in the settings?

This was actually an intentional choice. I didn't want people to just blindly import a bunch of presets, I wanted to them to understand the settings. I also didn't want users to be overwhelmed with choice, like the 1000s of Lightroom presets out there, it's so hard to settle on the "right one".

Instead, there’s twenty built-in ‘emulation’s (default iPhone colors + 19 simulations of film stocks), along with various sliders, allowing users to choose a look they like without having total control over the details. I was curious how this was implemented, and if it had anyth