# Gemfile
gem 'patch_ruby'
require 'patch_ruby'
# frozen_string_literal: true | |
require 'bundler/inline' | |
gemfile(true) do | |
source 'https://rubygems.org' | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
ruby '3.2.4' |
# based on ActiveSupport | |
# https://github.com/rails/rails/blob/6f0d1ad14b92b9f5906e44740fce8b4f1c7075dc/activesupport/lib/active_support/deprecation/constant_accessor.rb#L32 | |
module MyLib | |
module Deprecator | |
def self.included(base) | |
extension = Module.new do | |
def const_missing(missing_const_name) | |
puts "deprecator - const missing #{missing_const_name}" | |
if class_variable_defined?(:@@_deprecated_constants) |
# Example of how to create a lazy generator for Faker that | |
# can exclude certain values. | |
# | |
# How to run: | |
# ruby faker_excluding_generator.rb | |
# | |
require "faker" | |
require "test/unit" |
# how to run: | |
# $ ruby enum_in_order_of_test.rb | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } |
# frozen_string_literal: true | |
require 'bundler/inline' | |
gemfile(true) do | |
source 'https://rubygems.org' | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem 'rails', '= 6.1' |
# frozen_string_literal: true | |
require 'bundler/inline' | |
gemfile(true) do | |
source 'https://rubygems.org' | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem 'rails' |
# how to run: `$ ruby complex_arel_ordering_example.rb` | |
require 'bundler/inline' | |
gemfile(true) do | |
source 'https://rubygems.org' | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem 'rails' |
{ | |
"mode": "patterns", | |
"proxySettings": [ | |
{ | |
"title": "EMR SOCKS Proxy", | |
"type": 3, | |
"color": "#cc8c2a", | |
"address": "localhost", | |
"port": 8157, | |
"proxyDNS": true, |
(defn average [x y] (* 0.5 (+ x y))) | |
(defn improve [guess x] (average guess (/ x guess))) | |
(defn square [x] (* x x)) | |
(defn abs [x] (if (< 0 x) x (- 0 x))) | |
(defn good-enough? [guess x] | |
(< (abs (- x (square guess))) 0.0000001)) |