Skip to content

Instantly share code, notes, and snippets.

View jasonyork's full-sized avatar

Jason York jasonyork

  • Software Engineer
  • Nashville, TN
View GitHub Profile
@jasonyork
jasonyork / cleanup_slack_files.rb
Created December 7, 2015 01:24
Removing Old Slack Files (Ruby 1.9.3)
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 60 * 24 * 60 * 60).to_i # 60 days ago
uri = URI.parse("https://slack.com/api/files.list?token=#{@token}&ts_to=#{ts_to}&count=1000")
@jasonyork
jasonyork / ring_buffer.rb
Created June 26, 2023 19:13
Ring Buffer Example
class RingBuffer
attr_accessor :head, :tail, :items, :size, :count
def initialize(size:)
@size = size
@head = @tail = @count = 0
@items = []
end
@jasonyork
jasonyork / codeowner_tagging.rb
Created February 21, 2024 19:23
Adding RSpec tags based on CODEOWNERS
# Allow spec to be run by the owner specified in the CODEOWNERS file. The @joinswoop/ prefix is assumed
#
# eg. bin/rspec --tag codeowner:squad-network-be
#
RSpec.configure do |config|
# NOTE: Attempted to only apply these if a codeowner tag was supplied in the configuration
# However, it appears that this gets evaluated before the command line options are parsed and
# could not find a way to optimize this.
File.readlines('CODEOWNERS').each do |line|
next unless line.start_with?('/spec/')