Skip to content

Instantly share code, notes, and snippets.

View sferik's full-sized avatar

Erik Berlin sferik

View GitHub Profile
Mutant environment:
Usage: commercial
Matcher: #<Zombie::Mutant::Matcher::Config ignore: [Mutant::Isolation::Fork::Parent#call,Mutant::Zombifier#call,Mutant::Mutator::Node::Arguments#anonymous_block_arg?,Mutant::Mutator::Node::Arguments#emit_argument_presence,Mutant::Mutator::Node::Arguments#removed_block_arg?,Mutant::Mutator::Node::BlockPass#dispatch,Mutant::Mutator::Node::Arguments#forward_type?,Mutant::Mutator::Node::Send#emit_argument_propagation] subjects: [Mutant*] diffs: [#<Zombie::Mutant::Repository::Diff world=#<Mutant::World> to="main">]>
Integration: rspec
Jobs: 10
Includes: ["lib"]
Requires: ["mutant", "mutant/integration/rspec", "mutant/meta"]
Operators: full
MutationTimeout: 3600
Subjects: 3
This file has been truncated, but you can view the full file.
Mutant environment:
Usage: commercial
Matcher: #<Zombie::Mutant::Matcher::Config ignore: [Mutant::Isolation::Fork::Parent#call,Mutant::Zombifier#call,Mutant::Mutator::Node::Arguments#anonymous_block_arg?,Mutant::Mutator::Node::Arguments#emit_argument_presence,Mutant::Mutator::Node::Arguments#removed_block_arg?,Mutant::Mutator::Node::BlockPass#dispatch,Mutant::Mutator::Node::Arguments#forward_type?,Mutant::Mutator::Node::Send#emit_argument_propagation] subjects: [Mutant*]>
Integration: rspec
Jobs: 10
Includes: ["lib"]
Requires: ["mutant", "mutant/integration/rspec", "mutant/meta"]
Operators: full
MutationTimeout: 3600
Subjects: 934
@sferik
sferik / mutant.out
Created October 24, 2023 02:27
Erroring mutant output for x-ruby MediaUploader class
This file has been truncated, but you can view the full file.
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
@sferik
sferik / digits_cli.cr
Last active July 28, 2023 19:05
NYTimes Digits Game (aka Countdown) Solver written in Crystal by Erik Berlin
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 }
@sferik
sferik / twimg.cr
Last active September 4, 2021 14:43
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 }

What is the system Ruby?

What version of Ruby shipped by default on Mac OS X?

Default Ruby version * Refers to the fully patched version (e.g. 10.5.8, not 10.5.0). Earlier versions may have shipped with different Ruby patchlevels but the RUBY_VERSION has never changed within major Mac OS X releases.
Mac OS X version* Mac OS X release date