Tools for Troubleshooting Ruby
debugger
https://github.com/cldwalker/debugger
gem install debugger
In ~/.rdebugrc (You'll want to set these)
#!/usr/bin/perl | |
# Thank you Gavin Brock (http://brock-family.org/gavin/perl) - June 2007 | |
#==============================================================================# | |
use strict; | |
use warnings; | |
use Foundation; | |
#==============================================================================# |
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 |
# The below script attempts to automate the character encoding challenges | |
# encountered with mysql, latin1 and UTF8 | |
# http://www.bluebox.net/news/2009/07/mysql_encoding/ | |
# ============================================================================== | |
# Copyright © 2013 University of Notre Dame | |
# Additional copyright may be held by others, as reflected in the commit history. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. |
# Prerequisites: You need Ruby 2.4.4 or greater. My recommendation is to install ruby via rbenv (https://github.com/rbenv/rbenv) | |
# To run on the command line: | |
# 1) Download this gist | |
# 2) Run the following command: ruby /path/to/this/file.rb | |
class Scenario | |
attr_reader :failure, :compromised_success, :success, :critical, :total, :pool_size | |
def initialize(pool_size:) | |
@pool_size = pool_size | |
@total = 0 | |
@failure = 0 |
#!/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"), |
require 'forwardable' | |
gem 'dice_parser' | |
require 'dice' | |
# Responsible for registering random tables and exposing a means of rolling on those tables. | |
class TableRegistry | |
# @api public | |
# @example | |
# document = [{ | |
# key: '1-a', |
https://github.com/cldwalker/debugger
gem install debugger
In ~/.rdebugrc (You'll want to set these)
The associated Ruby script is more of a proof of concept to demonstrate using pipes and parameters in conjunction with the Rails runner. I have not fully verified that it works.
echo '<work_pid>' | bundle exec rails runner associate_pids_with_collection.rb -c <collection_pid>
cd /path/to/hyrax
rake engine_cart:regenerate
-- Rebuild the internal app; May not be necessaryrake engine_cart:server
-- Analogue to cd .internal_test_app; rails s
cd cd /path/to/hyrax
fcrepo_wrapper -v -p 8984 --no-jms
cd cd /path/to/hyrax
solr_wrapper -v -d solr/config/ -n hydra-development -p 8983
gantt | |
# See documentation concerning Mermaid-based gantt charts https://mermaidjs.github.io/gantt.html | |
# The PNG was generated via Atom's mermaid plugin | |
# * Install atom (https://atom.io) | |
# * Install atom-mermaid (https://atom.io/packages/atom-mermaid) | |
# * Open atom and paste this document into an empty buffer | |
# * Set Syntax to Mermaid | |
# * Type Command+Shift+P to search for the "Atom Mermaid: Toggle" to view the mermaid preview | |
# * In the preview pane, right click and select "Save As PNG" | |
dateFormat YYYY-MM-DD |