RUBY_VERSION
has never changed within major Mac OS X releases.
Mac OS X version* | Mac OS X release date |
---|
warning: parser/current is loading parser/ruby33, which recognizes 3.3.0-dev-compliant syntax, but you are running 3.3.0. | |
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri. | |
Mutant environment: | |
Matcher: #<Mutant::Matcher::Config subjects: [X::MediaUploader]> | |
Integration: minitest | |
Jobs: 10 | |
Includes: ["lib"] | |
Requires: ["x", "x/media_uploader"] | |
Operators: full | |
MutationTimeout: 10 |
require "option_parser" | |
class CountdownGame | |
OPERATORS = [:+, :-, :*, :/] | |
def initialize(@numbers : Array(Int32), @target : Int32) | |
end | |
def solve | |
result = solve_recursively(@numbers.map { |n| {n, n.to_s} }).find { |result, _| result == @target } |
require "http/client" | |
require "json" | |
require "oauth" | |
HOST = "api.twitter.com" | |
# Generate API keys at https://developer.twitter.com/en/portal/projects-and-apps | |
API_KEY = "Replace this with your Twitter API Key" | |
API_SECRET = "Replace this with your Twitter API Key Secret" | |
ACCESS_TOKEN = "Replace this with your Twitter Access Token" | |
ACCESS_TOKEN_SECRET = "Replace this with your Twitter Access Token Secret" |
class SizeAwareCache | |
@@cache = {} of String => Hash(Int32, String) | |
def read(key : String, size : Int32) | |
if value = @@cache.dig?(key, size) | |
# Hit! (both key and size) | |
return value | |
elsif results = @@cache[key]? | |
# Key hit, size miss | |
sorted_results = results.to_a.sort_by(&.first) |
require 'benchmark/ips' | |
def class_integer | |
0.class == Integer | |
end | |
def version_gte | |
RUBY_VERSION >= '2.4' | |
end |
digraph G { | |
label="Caddy Architecture" | |
labelloc="top" | |
fontsize=20 | |
fontname="Helvetica Neue" | |
node [shape="ellipse", style="filled", fontname="Helvetica Neue"] | |
edge [fontname="Helvetica Neue"] | |
peripheries=0 | |
rankdir="LR" | |
subgraph clusterClient { |
module Enumerable | |
def first_to_finish | |
threads = collect { |args| Thread.new { yield(args) } } | |
loop until done = threads.detect { |t| !t.alive? } | |
threads.each(&:kill) | |
done.value | |
end | |
end | |
puts [5, 3, 1, 2, 4].first_to_finish { |x| sleep x } |
RUBY_VERSION
has never changed within major Mac OS X releases.
Mac OS X version* | Mac OS X release date |
---|
require 'benchmark/ips' | |
require 'ostruct' | |
N = 100 | |
ATTRS = (:aa..:zz).take(N) | |
HASH = Hash[ATTRS.map { |x| [x, x] }] | |
CStruct = Struct.new(*ATTRS) | |
def struct |
def valid?(card_number) | |
digits = card_number | |
.split("") | |
.map { |number| number.to_i } | |
numbers = [] | |
digits.each_with_index do |digit, index| | |
if index.even? | |
numbers << digit * 2 | |
else |