Skip to content

Instantly share code, notes, and snippets.

View rickychilcott's full-sized avatar

Ricky Chilcott rickychilcott

View GitHub Profile
View sales_list_organization_csv_download.rb
# frozen_string_literal: true
class SalesListOrganizationCsvDownload < Avo::BaseAction
self.name = "CSV Download"
self.may_download_file = true
self.confirm_button_label = "Download"
def handle(**args)
_models, _fields, _current_user, resource = args.values_at(:models, :fields, :current_user, :resource)
View fast-lookup.rb
require "active_support/all"
Resource = Struct.new(:absolute_path)
paths = [
Resource.new("/bread/crumbs/three"),
Resource.new("/bread"),
Resource.new("/bread/crumbs"),
Resource.new("/bread/crumbs/one"),
Resource.new("/bread/crumbs/two"),
@rickychilcott
rickychilcott / avo-test-helpers.rb
Created December 8, 2022 17:39
Some Example Avo Test Helpers
View avo-test-helpers.rb
def avo_flatpickr_pick(selector, with:)
base_field = find(selector, visible: false)
flatpickr_field_identifier = base_field["data-resource-edit-target"]
flatpickr_field = find("[data-resource-edit-target='#{flatpickr_field_identifier}'].flatpickr-input", visible: false)
new_selector_id = flatpickr_field["id"]
flatpickr_pick("##{new_selector_id}", with: with)
end
def avo_tagify_select(field_selector, with:, retries: 3)
raise("Unable to select '#{with}' from '#{field_selector}'") if retries == 0
@rickychilcott
rickychilcott / goal_and_strategies.rb
Created July 13, 2022 13:28
Fun with Goals and Strategies
View goal_and_strategies.rb
class Base
def initialize(id)
@id = id
end
def name
"#{self.class.name} #{@id}"
end
end
@rickychilcott
rickychilcott / render.com.log
Created March 11, 2022 03:00
Bridgetown render.com log
View render.com.log
Mar 10 09:56:57 PM ==> Cloning from https://github.com/mission-met/bridgetown-test...
Mar 10 09:56:57 PM ==> Checking out commit 8942612de1fb5c174fbbf51067e51ca6172d6f5d in branch main
Mar 10 09:56:59 PM ==> Downloading cache...
Mar 10 09:57:10 PM ==> Downloaded 177MB in 5s. Extraction took 4s.
Mar 10 09:57:15 PM ==> Installing dependencies with Yarn...
Mar 10 09:57:15 PM yarn install v1.22.17
Mar 10 09:57:15 PM [1/4] Resolving packages...
Mar 10 09:57:15 PM success Already up-to-date.
Mar 10 09:57:15 PM Done in 0.16s.
Mar 10 09:57:15 PM ==> Installing dependencies with bundler...
@rickychilcott
rickychilcott / trace.log
Created February 23, 2022 00:14
Thredded DB Pool Exhaustion Stacktrace
View trace.log
Feb 21 18:20:41 app-name app/web.1 #<Thread:0x00007fe73838ea10 /app/vendor/bundle/ruby/3.0.0/bundler/gems/thredded-9a7158d4a307/lib/thredded/collection_to_strings_with_cache_renderer.rb:84 run> terminated with exception (report_on_exception is true):
Feb 21 18:20:41 app-name app/web.1 /app/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:210:in `block in wait_poll': could not obtain a connection from the pool within 5.000 seconds (waited 5.000 seconds); all pooled connections were in use (ActionView::Template::Error)
Feb 21 18:20:41 app-name app/web.1 from /app/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:199:in `loop'
Feb 21 18:20:41 app-name app/web.1 from /app/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:199:in `wait_poll'
Feb 21 18:20:41 app-name app/web.1 from /app/vendor/bundle/ruby/3.0.0/gem
@rickychilcott
rickychilcott / cloudSettings
Last active February 12, 2022 20:34
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2022-02-12T20:34:47.219Z","extensionVersion":"v3.4.3"}
@rickychilcott
rickychilcott / slim_select_controller.js
Last active December 28, 2021 05:10
Slim-select stimulus controller
View slim_select_controller.js
import { Controller } from "stimulus"
import SlimSelect from "slim-select"
import "slim-select/dist/slimselect.min.css"
import "../style/slimselect-customized.css"
export default class extends Controller {
connect() {
const limit = this.data.get("limit")
const placeholder = this.data.get("placeholder")
const searchText = this.data.get("no-results")
@rickychilcott
rickychilcott / pro_tools_11_munki.sh
Last active October 26, 2021 23:45
My (working) attempt to get PT 11 to install successfully
View pro_tools_11_munki.sh
#!/bin/bash
# Copy the com.avid.bsd.DigiShoeTool Helper Tool
PHT_DIGISHOETOOL="/Library/PrivilegedHelperTools/com.avid.bsd.DigiShoeTool"
/bin/cp "/Applications/Pro Tools.app/Contents/Library/LaunchServices/com.avid.bsd.DigiShoeTool" $PHT_DIGISHOETOOL
/usr/sbin/chown root:wheel $PHT_DIGISHOETOOL
/bin/chmod 544 $PHT_DIGISHOETOOL
# Create the Launch Deamon Plist for com.avid.bsd.DigiShoeTool
@rickychilcott
rickychilcott / newsletter-signup-trigger.html
Created August 25, 2021 00:03
Trigger a newsletter signup popup every 30 days
View newsletter-signup-trigger.html
<link rel="stylesheet" href="https://s.electerious.com/basicLightbox/dist/basicLightbox.min.css" />
<script src="https://s.electerious.com/basicLightbox/dist/basicLightbox.min.js"></script>
<script type="text/javascript">
const storage = window.localStorage
const NEWSLETTER_KEY = "newsletter-signup-trigger"
const DAYS_IN_MS = 86_400_000
const RESHOW_DAYS = 30 * DAYS_IN_MS
const DELAY_POP_SECONDS = 20 * 1_000