| name | explain-diff-html |
|---|---|
| description | Use when the user asks for a rich explanation of a code change, diff, branch, or PR. Produces HTML output. |
Please make me a rich, interactive explanation of the specified code change.
It should have these sections:
| # 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) |
This is a personal guide for how to setup Fish & Ruby in macOS Monterey running on an Apple/Silicon M1.
asdf is used as a version manager for Node and Ruby.
Go to https://brew.sh/ and run the script.
On this version of macOS, it installs to /opt/homebrew.
This means that paths that reference /usr/local/share should instead reference /opt/homebrew/opt/<package-name>/share.
This can be a little confusing when following guides.
| # Install via command-line as 'gem install sparql-client' | |
| require 'sparql/client' | |
| headers = { 'User-Agent' => 'Ruby-Sparql-Client/1.0' } | |
| @sparql = SPARQL::Client.new("https://query.wikidata.org/sparql", headers: headers, read_timeout: 120) | |
| # A SPARQL query to find an item and an optional Twitter handle | |
| def wikidata_by_orcid_query(orcid) | |
| %Q( | |
| SELECT ?item ?itemLabel ?twitter |
Feedback loop speed in one of the biggest contributing factors to overall development time. The faster you get results, the faster you can move on to other things. A fast enough test suite is therefore critical to teams' success, and is worth investing some time at the beginning to save in the long run.
Below is a list of techniques for speeding up a Rails test suite. It is not comprehensive, but should definitely provide some quick wins. This list of techniques assumes you're using minitest, but most everything should translate over to rspec by simply replacing test/test_helper.rb with spec/spec_helper.rb.
| # Ruby CircleCI 2.0 configuration file | |
| # | |
| # Check https://circleci.com/docs/2.0/language-ruby/ for more details | |
| defaults: &defaults | |
| working_directory: ~/split_app | |
| parallelism: 2 | |
| docker: | |
| - image: circleci/ruby:2.5.0-node-browsers |
| # https://gist.github.com/EdwardDiehl/9c660b59d0fb2e936774ee2c4fcfc792 | |
| # Read and specify ruby version in Gemfile from asdf-vm .tool-versions file. | |
| # Copy the file to your your project root. | |
| # Add these lines at the top of your project Gemfile: | |
| # require './ruby_version.rb' | |
| # ruby ruby_version | |
| def ruby_version(ruby_default_version = '2.5.0') | |
| tool_versions_file = File.join(File.expand_path('..', __FILE__), '.tool-versions') |
| - restore_cache: | |
| keys: | |
| - v1-asset-cache-{{ arch }}-{{ .Branch }} | |
| - v1-asset-cache- | |
| - run: bundle exec rake assets:precompile | |
| - save_cache: | |
| key: v1-asset-cache-{{ arch }}-{{ .Branch }}-{{ epoch }} | |
| paths: |
Following instructions from the excellent https://www.rinkeby.io/
A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,
| def fill_stripe_elements(card) | |
| using_wait_time(15) { within_frame('stripeField_card_element0') do | |
| card.to_s.chars.each do |piece| | |
| find_field('cardnumber').send_keys(piece) | |
| end | |
| find_field('exp-date').send_keys("0122") | |
| find_field('cvc').send_keys '123' | |
| find_field('postal').send_keys '19335' | |
| end } |