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
require "database_cleaner" | |
require "database_cleaner/active_record/deletion" | |
module DatabaseCleaner | |
module ActiveRecord | |
module SelectiveTruncation | |
def information_schema_exists?(_connection) | |
true |
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 ruby | |
require "thor" | |
require "net/http" | |
require "json" | |
class CircleScientist < Thor | |
option :circle_api_token, required: true | |
option :control_branch, default: "master" | |
option :candidate_branch, required: true |
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 ruby | |
require "octokit" | |
require "netrc" | |
# Pass the repo to reap: | |
# bin/reaper username/repository | |
repo = ARGV[0] | |
# Set the FORCE environment variable to "true" to actually perform actions: |
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 ruby | |
require 'thor' | |
require 'dogapi' | |
require 'pry' | |
class DatadogPry < Thor | |
DatadogDashboard = Struct.new(:name, :queries) | |
DatadogMonitor = Struct.new(:name, :queries) |
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
def each_char_matching_pattern(io, pattern) | |
return enum_for(:each_char_matching_pattern, io, pattern) unless block_given? | |
io.each_line.lazy.select do |line| | |
line =~ pattern | |
end.flat_map do |line| | |
line.chars | |
end.each do |line| | |
yield line | |
puts "\toffset: #{io.pos}" |
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
require "test_helper" | |
class MemoizedAttributesTest < IdentityCache::TestCase | |
def test_memoization_should_not_break_dirty_tracking | |
item = Item.create! | |
IdentityCache.cache.with_memoization do | |
Item.fetch(item.id) | |
Item.fetch(item.id).title = "my title" | |
Item.fetch(item.id).update(title: "my title") |
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 | |
hosted_zone_id=$1 | |
hostnames=`./get_hostnames_from_hosted_zone.sh "$hosted_zone_id"` | |
while read hostname; do | |
echo "$hostname" | |
instance_id=`./hostname_to_instance_id.sh "$hostname"` | |
if [[ -z $instance_id ]]; then | |
echo " hostname doesn't contain instance id, skipping." | |
else |
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
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'mysql2' | |
gem 'benchmark-ips' |
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 ruby | |
# Git post-commit hook that sends an approximation of GitHub's 'push' webhook | |
# after every commit. Helpful for testing code that consumes those webhooks. | |
# | |
# To set this up: | |
# 1. Create a local repo where you'll make test commits | |
# 2. Copy this script to .git/hooks/post-commit | |
# 3. Make it executable: `chmod +x .git/hooks/post-commit` | |
# 4. Change the `uri` variable below to where webhooks should be sent |
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 TestModule | |
end | |
class Included | |
class << self | |
include TestModule | |
end | |
end | |
class Prepended |
NewerOlder