This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Technical and architectural audit of a system. This is an evolving documentation vault, not a codebase.
| brew install rbenv ruby-build | |
| # for YJIT | |
| brew install rust | |
| # for "-dev" versions | |
| brew install bison | |
| # currently for version 5 | |
| brew install jemalloc |
| #!/usr/bin/env bash | |
| function get_headphones_index() { | |
| echo $(pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}') | |
| } | |
| function get_headphones_mac_address() { | |
| local temp=$(pacmd list-cards | grep bluez_card -C20 | grep 'device.string' | cut -d' ' -f 3) | |
| temp="${temp%\"}" | |
| temp="${temp#\"}" |
| Article: https://github.com/puma/puma/blob/master/docs/systemd.md | |
| #1 nano /etc/systemd/system/puma.service | |
| #2 paste from puma.service | |
| Commands: | |
| # After installing or making changes to puma.service | |
| systemctl daemon-reload | |
| # Enable so it starts on boot | |
| systemctl enable puma.service |
| # from gitlab/spec/support/matchers/exceed_query_limit.rb | |
| RSpec::Matchers.define :exceed_query_limit do |expected| | |
| supports_block_expectations | |
| match do |block| | |
| @subject_block = block | |
| actual_count > expected_count + threshold | |
| end | |
| failure_message_when_negated do |actual| |
| # Usage: | |
| # | |
| # class Mail | |
| # include SimpleStateMachine | |
| # | |
| # self.initial_state = 'unread' | |
| # self.transitions_map = { | |
| # read: {from: 'unread', to: 'read'}, | |
| # unread: {from: 'any', to: 'unread'}, | |
| # delete: {from: 'any', to: 'deleted'}, |
| module SimpleRailway | |
| class Result | |
| attr_accessor :success, :data | |
| def initialize(success, data) | |
| @success = success | |
| @data = data | |
| end | |
| def success?; !!success; end | |
| def failure?; !success?; end |
| # FOR BUSY JOBS | |
| # take the process_id from the /busy page in sidekiq and kill the longest running one. | |
| workers = Sidekiq::Workers.new | |
| long_process_id = 'integration.3:4:71111aaa111' # Eg: 'integration.3:4:71d1d7f4ef5a' | |
| workers.each do |process_id, thread_id, work| | |
| process = Sidekiq::Process.new('identity' => process_id) | |
| process.stop! if process_id == long_process_id | |
| end | |
| # FOR SCHEDULED JOBS |
| 1. Change rails version in Gemfile | |
| > gem 'rails', '~> 5.1', '>= 5.1.4' | |
| 2. Remove Gemfile.lock | |
| > git rm Gemfile.lock | |
| 3. Run bundle install command | |
| > bundle install --jobs=5 | |
| 4. Run rails' app update to apply changes to app |
| # While having issues with to_partial_path on a view model giving inconsistent results under differing name spaces of controllers | |
| # I use the below to see that the look up path and view paths were on an controller and modify. | |
| # I've never put the below into production. This is merely something I found while experimenting. | |
| # To sort my issue I used the prefixes avaialable and changed name spacing to give correct behaviour | |
| class SomeController < ApplicationController | |
| # Prepending (or appending) the view path allows you to add the location of view files | |
| before_filter :prepend_view_paths |