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 ExampleJob < ApplicationJob | |
| STEPS = [ | |
| { :band => "The Baboon Show" }, | |
| { :band => "Blowfuse" }, | |
| { :band => "CRIM" } | |
| ].each(&:freeze).freeze | |
| def perform(options) | |
| time = Time.at(options.fetch(:timestamp)) | |
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
| namespace :lint do | |
| task :rubocop_config do | |
| errors = [] | |
| Dir[File.expand_path("../../../config/rubocop/*.yml", __dir__)].each do |f| | |
| config = Psych.parse_file(f)&.children&.first | |
| unless config.is_a? Psych::Nodes::Mapping | |
| errors << "Invalid config: #{f}" | |
| next |
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 "benchmark/ips" | |
| NAMED_TPL = "$%<value>d" | |
| POSITIONAL_TPL = "$%d" | |
| VALUE = 123.456 | |
| VALUE_PARAMS = { :value => VALUE }.freeze | |
| Benchmark.ips do |x| |
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
| FILES_RE = %r{^(app|config|lib)/.*\.(rb|yml)$} | |
| IO.popen(["git", "ls-files"]) do |io| | |
| io.each_line do |file| | |
| puts file if FILES_RE.match?(file) | |
| end | |
| end | |
| IO.popen(["bundler", "list", "--paths"]) do |bundler_io| | |
| bundler_io.each_line.to_a.each do |path| |
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
| #!/bin/bash | |
| files=() | |
| args=() | |
| hashbang_regexp="^#\\!(/bin/|/usr/bin/env )?(sh|tcsh|csh|dash|bash)" | |
| function lookup() { | |
| while IFS= read -d $'\0' -r file; do | |
| if [[ "${file}" =~ ^.*\.(ba|c|da|tc|z)?sh$ ]] \ | |
| || head "${file}" -n 1 | grep -E -q "${hashbang_regexp}"; then |
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
| module AutocorrectThruDisableCuzWeSuckAtWritingGoodCode | |
| def autocorrect(node) | |
| ->(corrector) do | |
| until autocorrect_on.include? node&.type | |
| node = node&.parent | |
| return unless node | |
| end | |
| lines = node.source.lines | |
| match = lines[0].match(/^(.*?)\s*((?<!\\)#(.*))?$/) |
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 bash -x | |
| # Creates RAM disk. | |
| # | |
| # SYNOPSIS | |
| # create_ramdisk [size [label]] | |
| # | |
| # OPTIONS | |
| # size: RAM disk size in megabytes. Default: 1024 | |
| # label: RAM disk volume label. Default: UUID |
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/ruby | |
| $TESTING = false # rubocop: disable Style/GlobalVars | |
| require "bundler/setup" | |
| require "sidekiq/cli" | |
| begin | |
| cli = Sidekiq::CLI.instance | |
| cli.parse |
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
| Codegen (bc+obj): 00:41:40.1161902 (1098.87MB) | |
| Codegen (linking): x86_64-pc-linux-gnu-gcc -o "/var/tmp/portage/dev-lang/crystal-0.22.0/work/crystal-0.22.0/.build/crystal" "${@}" -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -rdynamic /var/tmp/portage/dev-lang/crystal-0.22.0/work/crystal-0.22.0/src/llvm/ext/llvm_ext.o `/usr/bin/llvm-config --libs --system-libs --ldflags 2> /dev/null` -lstdc++ -lpcre -lm -lgc -lpthread /var/tmp/portage/dev-lang/crystal-0.22.0/work/crystal-0.22.0/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib _main.o | |
| fork: Cannot allocate memory | |
| 0x540b4e: ??? at ?? | |
| 0x10fda55: ??? at ?? | |
| 0x14fffc7: ??? at ?? | |
| 0x14fef65: ??? at ?? | |
| 0x1437a08: ??? at ?? | |
| 0x1cb6645: ??? at ?? | |
| 0x5a23f9: ??? at ?? |
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
| module HStruct | |
| def self.new(**props) | |
| attrs = props.map { |s| ":#{s}" }.join(", ") | |
| init = attrs.map { |s| "@#{s} = #{s}" }.join("\n") | |
| args = props.map { |s| "#{s}: nil" }.join(", ") | |
| Class.new do | |
| class_eval <<-RUBY | |
| attr_accessor #{attrs.map { |s| ":#{s}" }.join ", "} | |
| def initialize(#{args}) |