Skip to content

Instantly share code, notes, and snippets.

View rickychilcott's full-sized avatar

Ricky Chilcott rickychilcott

View GitHub Profile
@rickychilcott
rickychilcott / History|-113ebd92|entries.json
Last active November 21, 2024 18:48
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///Users/rickychilcott/github/causey/config/environments/production.rb","entries":[{"id":"u7Kq.rb","timestamp":1731692934799},{"id":"RW0D.rb","timestamp":1731692984005},{"id":"LPQK.rb","timestamp":1731693011128},{"id":"9c0t.rb","timestamp":1731693026569},{"id":"7EDJ.rb","timestamp":1731693042599},{"id":"4S9P.rb","timestamp":1731693055247},{"id":"jOmH.rb","timestamp":1731693068728},{"id":"TRiU.rb","timestamp":1731693150654},{"id":"0myS.rb","timestamp":1731693171969},{"id":"io3S.rb","timestamp":1731693252168},{"id":"QNku.rb","timestamp":1731693290172},{"id":"YSra.rb","timestamp":1731693324764},{"id":"Wetr.rb","timestamp":1731693340034},{"id":"c1UI.rb","timestamp":1731693358656},{"id":"VJss.rb","timestamp":1731693373623},{"id":"4Kv0.rb","timestamp":1731693416259},{"id":"2fte.rb","timestamp":1731693435747}]}
@rickychilcott
rickychilcott / slim_select_helper.rb
Last active October 10, 2024 23:17
slim-select capybara helpers
## from @dinshaw in https://github.com/brianvoe/slim-select/pull/246
## Assumption is that you have a label who's parent also contains the select list you are choosing from.
def js_select(item_text, options)
container = find(:xpath, "//parent::*[label[text()='#{options[:from]}']]")
within "##{container[:id]}", visible: false do
find('.ss-arrow').click
input = find(".ss-search input").native
input.send_keys(item_text)
find('div.ss-list').click
@rickychilcott
rickychilcott / gist:3222c15663dac7d987a1
Created September 9, 2015 19:09
Logic Package Downloads
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/GarageBandBasicContent.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/JamPack1.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/JamPack4_Instruments.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_AppleLoopsChillwave.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_AppleLoopsDeepHouse.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_AppleLoopsDubstep.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_AppleLoopsElectroHouse.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_AppleLoopsHipHop.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_AppleLoopsLegacy1.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_AppleLoopsLegacyRemix.pkg
@rickychilcott
rickychilcott / validations.rb
Created June 13, 2024 15:36
Dynamic validations
class MyModel
include ActiveModel::Model
attr_accessor :name, :email, :options
def initialize(attributes = {})
super
@options ||= {}
end
@rickychilcott
rickychilcott / pm.rb
Last active March 27, 2024 12:33
Ruby Pattern Matching Shenanigans
def example(label)
puts "## #{label}"
yield
puts
puts
end
example("Foo.===(v)") do
class Foo
def self.===(v)
@rickychilcott
rickychilcott / ffmpeg_merge.thor
Last active January 28, 2024 16:16
FFMpeg multi video overlay
class Ffmpeg < Thor
package_name "ffmpeg"
desc "install", "install ffmpeg"
def install
`brew install ffmpeg`
end
desc "merge FILE1 FILE2 FILE3 FILE4 OUTPUT", ""
def merge(file_1, file_2, file_3, file_4, output_file)
# 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)
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
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
class Base
def initialize(id)
@id = id
end
def name
"#{self.class.name} #{@id}"
end
end