This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| require "bundler/inline" | |
| gemfile do | |
| gem "grape", "2.2.0" | |
| gem "grape-swagger", "2.1.2" | |
| gem "benchmark-ips" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gem "sqlite3", "~> 1" | |
| require 'sqlite3' | |
| gem "activerecord", "~> 7.1" | |
| require 'active_record' | |
| # Set up a database that resides in RAM | |
| ActiveRecord::Base.establish_connection( | |
| adapter: 'sqlite3', | |
| database: ':memory:' | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "rspec/autorun" | |
| RSpec.describe "exceptional tekin" do | |
| after(:each) do |example| | |
| p example, example.exception | |
| end | |
| it "passes" do | |
| expect(1).to eq(1) # duh | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .. snip .. | |
| # Lifted from https://grafana.com/docs/grafana-cloud/quickstart/docker-compose-linux/#step-1-create-the-compose-file on 2022-10-07 | |
| grafana-node-exporter = { | |
| # https://github.com/prometheus/node_exporter/releases | |
| image = "prom/node-exporter:v1.7.0"; | |
| autoStart = true; | |
| extraOptions = [ | |
| "--cpus=1" | |
| "--memory=512m" | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ActiveJob::Base.queue_adapter = :delayed | |
| $stdout.sync = true | |
| $stdout.flush | |
| class MyBaseJob < ActiveJob::Base | |
| # Stop delayed retrying at all | |
| def max_attempts | |
| 0 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Error = Class.new(StandardError) | |
| class Client | |
| Error = Class.new(StandardError) | |
| def call | |
| raise "ZOMG" | |
| rescue => e | |
| raise Error.new("Uh oh #{e.inspect}") | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| # Custom inflector for Zeitwerk | |
| # | |
| # The default inflector at ActiveSupport::Dependencies::ZeitwerkIntegration::Inflector only | |
| # lets us override by `basename`, but we have both `Thing` and `THING` defined as constants | |
| # in the app so that doesn't work for us. Rather than rename everything just now, work around it | |
| # by letting us define overrides by _filepath_ (`abspath`) as well as `basename`. | |
| # | |
| # NB: Normally we'd subclass the default implementation, but it's a Module so can't do that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "auto_update": true, | |
| "base_keymap": "TextMate", | |
| "default_dock_anchor": "bottom", | |
| "projects_online_by_default": false, | |
| "theme": "Ayu Light", | |
| "buffer_font_family": "FiraCode Nerd Font Mono", | |
| "buffer_font_size": 14, | |
| "tab_size": 2, | |
| "hard_tabs": false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "benchmark/ips" | |
| Benchmark.ips do |b| | |
| b.report("Array.new block") do | |
| Array.new(100) { 10 } | |
| end | |
| b.report("Array.new argument") do | |
| Array.new(100, 10) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| auto_https off | |
| } | |
| :8080 { | |
| root * . | |
| file_server | |
| templates | |
| } |
NewerOlder