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 | |
| class Roda | |
| module RodaPlugins | |
| module ContentForExtensions | |
| def self.load_dependencies(app, _opts = OPTS) | |
| app.plugin :content_for | |
| end | |
| module InstanceMethods |
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
| #!/usr/bin/env ruby | |
| # frozen_string_literal: true | |
| require "bundler" | |
| require "bundler/inline" | |
| Bundler.settings.temporary(frozen: false, deployment: false) do | |
| gemfile do | |
| source "https://rubygems.org" | |
| platform "ruby" do |
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
| $fa = 0.5; | |
| $fs = 0.2; | |
| module outerShape() { | |
| module wrapCyl() { | |
| cylinder(d=50, h = 15); | |
| }; | |
| hull() { | |
| translate([0,0,0]) wrapCyl(); | |
| translate([-30,(-15/2),0]) cube(15); |
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
| $logger = Logger.new("my.log") | |
| prev_trap = Signal.trap("HUP") do |*args| | |
| $logger.reopen | |
| prev_trap.call(*args) if prev_trap.respond_to?(:call) | |
| 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 | |
| # renamed files for gist compatibility - should be in sub-folders (dmp/*) | |
| require_relative "dmp__diff" | |
| require_relative "dmp__render" | |
| # Diff-Match-Path | |
| # https://github.com/google/diff-match-patch | |
| module DMP | |
| extend Diff |
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
| SRC_PATH=../big_data_dir | |
| DEST_PATH=/var/data | |
| SERVICE=app |
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
| $ vagrant up --debug | |
| INFO global: Vagrant version: 2.2.9 | |
| INFO global: Ruby version: 2.6.6 | |
| INFO global: RubyGems version: 3.0.3 | |
| INFO global: VAGRANT_EXECUTABLE="C:\\HashiCorp\\Vagrant\\embedded\\gems\\2.2.9\\gems\\vagrant-2.2.9\\bin\\vagrant" | |
| INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="C:\\HashiCorp\\Vagrant\\embedded" | |
| INFO global: VAGRANT_INSTALLER_ENV="1" | |
| INFO global: VAGRANT_INSTALLER_VERSION="2" | |
| INFO global: VAGRANT_LOG="debug" | |
| WARN global: resolv replacement has not been enabled! |
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 | |
| # Some, probable not extreamly clever, micro benchmarks to compare | |
| # different methods of "return a value or error". | |
| # The samples benchmark the error path only. | |
| require 'benchmark/ips' | |
| require 'dry/monads/result' | |
| M = Dry::Monads |
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 "pp" | |
| require "reform" # that's what we want to get rid of | |
| require "dry-validation" | |
| require "trailblazer" | |
| require "trailblazer/operation" | |
| # For the sake of this sample, the "model" class is a bit simple | |
| Customer = Hash |
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
| class MyBaseSchema < Dry::Validation::Schema | |
| configure do | |
| # my custom predicates, messages_file, etc. | |
| end | |
| end | |
| TestSchema = Dry::Validation.Form(MyBaseSchema) do | |
| required(:foo).filled | |
| end |