Skip to content

Instantly share code, notes, and snippets.

View jeremyf's full-sized avatar

Jeremy Friesen jeremyf

View GitHub Profile
@jeremyf
jeremyf / meld-review-results.txt
Last active February 28, 2024 22:14
Review of Hyku i2 vs i35 vs Hyrax Double Combo
Again with the markdown. Imagine if we'd changed the method instead of the views! Oh well this is one that is in Hyrax as well. 📑 app/views/hyrax/my/collections/_list_collections.html.erb
Again with the markdown. 📑 app/views/hyrax/dashboard/works/_list_works.html.erb
Alters rendering of component's CSS also has some additional logic. Likely keep. 📑 app/views/catalog/_index_list_default.html.erb
Bring over Hyrax updates but we need version logic 📑 app/assets/javascripts/hyrax/editor.es6
Compare and merge into i35's app/controllers/concerns/hyku/works_controller_behavior.rb 📑 app/controllers/concerns/hyrax/works_controller_behavior.rb
Consider removing as we should have this config section hidden; and wouldn't need another view override. 📑 app/views/hyrax/dashboard/show_admin.html.erb
Consider removing if the underlying flash message bug is fixed 📑 app/views/layouts/hyrax/dashboard.html.erb
Convert to decorator with default image based on Site 📑 app/services/hyrax/thumbnail_path_service.rb
Cr
@jeremyf
jeremyf / org-get-headings-alternate.el
Created February 24, 2024 14:09
An alternate implementation of Howard Abrams' `org-get-headings'.
;; An alternate implementation of Howard Abrams' `org-get-headings'.
;;
;; https://howardism.org/Technical/Emacs/tiddly-wiki-in-org.html
;;
;; I have not run any performance comparisons. The main difference being that
;; this implementation does not require defining the `unpropertize' function.
(defun org-get-headings ()
"Return a list of an org document's headings."
(org-element-map
(org-element-parse-buffer 'headline nil t)
# frozen_string_literal: true
module Hyrax
##
# @api public
#
# Cast an object to its AccessControlList
#
# @param [Object] an object to try to cast
#

tl;dr It appears that the memory adapter has a bug in the double_combo branch of Hyrax.

Note: I have run the below in double_combo and have run the code in main. In double_combo I'm seeing duplicate resources. In main, I'm not. Which highlights that perhaps the persister is not doing it's job correctly.

Reviewing spec/services/hyrax/access_control_list_spec.rb#L156 (see below), I added a debug in the change { } to see the values before and after calling acl.save.

it 'deletes the permission policy' do
@jeremyf
jeremyf / graph.yml
Last active January 18, 2024 19:55
Create a graph of Hyrax Transactions
---
- name: change_set.apply
class_name: Hyrax::Transactions::ApplyChangeSet
events: []
steps:
- class_name: Hyrax::Transactions::Steps::SetModifiedDate
steps: []
events: []
name: change_set.set_modified_date
- class_name: Hyrax::Transactions::Steps::SetUploadedDateUnlessPresent
#!/usr/bin/env ruby -w
##############################################################
#
# Begin Commentary
#
##############################################################
#
# First, if you want to use this, I recommend you change the
# the file mode to executable:
@jeremyf
jeremyf / weighted_query_strategy.rb
Last active November 3, 2021 16:04
Articles::Feeds::WeightedQueryStrategy class as of 2021-11-3
module Articles
module Feeds
# @api private
#
# This is an experimental object that we're refining to be a
# competetor to the existing feed strategies.
#
# It works to implement conceptual parity with two methods of
# Articles::Feeds::LargeForemExperimental:
#
@jeremyf
jeremyf / org-roam-configuration.el
Last active May 30, 2022 06:30
org-roam configuration
;; See
;; http://takeonrules.com/2021/08/22/ever-further-refinements-of-org-roam-usage/
;; for details on this configuration.
;;
;; See https://takeonrules.com/2021/08/23/diving-into-the-implementation-of-subject-menus-for-org-roam/
;; for a walk through of the implementation.
;;
;; A Property List of my `org-roam' capture templates.
(setq jnf/org-roam-capture-templates-plist
(list
@jeremyf
jeremyf / probability_swn_stabilize.rake
Last active December 28, 2020 22:12
Calculate the probability of stabilization with treatment
desc "Calculate the probability of stabilization with treatment"
task :probability_swn_stabilize do
# This class encapsulates the probability calculations based on
# the given :distribution.
class Universe
def initialize(label:, distribution:)
@label = label
@distribution = distribution
@max = distribution.keys.max
@size = distribution.values.sum.to_f
@jeremyf
jeremyf / embarkation_and_journey_scenarios_for_aime.rb
Last active December 19, 2018 16:30
A script for running scenarios against Adventures in Middle-earth Embarkation and Journey rules; See http://takeonrules.com/2018/12/19/diving-further-into-embarkation/
#!/usr/bin/env ruby -wKU
ITERATIONS = 100_000
TERRAINS = %i(easy moderate hard severe daunting)
Guide = Struct.new(:survival_proficiency, :wisdom_modifier, :label) do
def to_s; label; end
end
GUIDES = [
Guide.new(0,-1, "naive level 1"),
Guide.new(2,2, "trained level 1"),