ruby ./yaml_to_json_patch.rb OLD_YAML_FILE_PATH NEW_YAML_FILE_PATH
This file contains 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
# typed: true | |
# frozen_string_literal: true | |
module Tapioca | |
module Compilers | |
class RedisObjects < Tapioca::Dsl::Compiler | |
extend T::Sig | |
ConstantType = type_member { { fixed: T.all(T::Class[::Redis::Objects], ::Redis::Objects::ClassMethods) } } |
This file contains 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 'fileutils' | |
require 'rbi' | |
require 'active_support/all' | |
# SigDivider divides a single RBI file into multiple files by each class or module. | |
class SigDivider < RBI::Visitor | |
TreeWithName = Struct.new(:name, :tree, keyword_init: true) |
This file contains 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 'debug' | |
module DebugHelper | |
class << self | |
def debug_on_error | |
yield | |
rescue => e | |
enter_postmortem_session(e) | |
raise e | |
end |
This file contains 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 | |
set -ex | |
TMPDIR=`mktemp -d` | |
cd $TMPDIR | |
git clone -b support-debug-gem https://github.com/tomoasleep/vscode-ruby-test-adapter | |
cd vscode-ruby-test-adapter |
This file contains 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 "yard" | |
require "stringio" | |
require "fileutils" | |
Example = Struct.new(:path, :name, :code, :file, :lineno, keyword_init: true) | |
def generate(*args) | |
::YARD.parse(*args) | |
code_objects = ::YARD::Registry.all.select do |code_object| |
This file contains 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
// Returns R if T is a function, otherwise returns Fallback | |
type IsFunction<T, R, Fallback = T> = T extends (...args: any[]) => any ? R : Fallback | |
// Returns R if T is an object, otherwise returns Fallback | |
type IsObject<T, R, Fallback = T> = IsFunction<T, Fallback, (T extends object ? R : Fallback)> | |
// "a.b.c" => "b.c" | |
type Tail<S> = S extends `${string}.${infer T}`? Tail<T> : S; | |
// typeof Object.values(T) |
This file contains 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
# Usage: ruby gh-monthly-contributions.rb <year> <month> <organization name> | |
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'graphql-client' | |
end | |
require 'graphql/client' |
This file contains 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
function archiveOldEmailsWithWillArchiveLabel() { | |
var willArchiveThreads = GmailApp.search("label:willarchive older_than:3d in:inbox"); | |
for (var i = 0; i < willArchiveThreads.length; i++) { | |
willArchiveThreads[i].markRead(); | |
willArchiveThreads[i].moveToArchive(); | |
} | |
} |
This file contains 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 TaskList | |
attr_reader :markdown | |
# @param markdown [String] | |
def initialize(markdown) | |
@markdown = markdown | |
end | |
# @return [CommonMarker::Node] | |
def document |
NewerOlder