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
RSpec::Matchers.define :include_json do |expected_json| | |
match do |actual_json| | |
expect(hashify(actual_json)).to include(hashify(expected_json)) | |
end | |
def hashify(object) | |
return object.stringify_keys if object.class == Hash | |
JSON.parse(object) | |
end | |
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
##########==============================########## | |
from ruby:2.4.10 AS ruby-base | |
##########==============================########## | |
# install bundler version that matches Gemfile | |
RUN gem install bundler -v '1.17.3' | |
# throw errors if Gemfile has been modified since Gemfile.lock | |
# RUN bundle config --global frozen 1 |
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
set number | |
syntax on | |
highlight LineNr ctermfg=grey |
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 'byebug' | |
require 'rspec' | |
class BubbleSort | |
attr_reader :arr | |
def initialize(input) | |
@arr = input | |
end | |
def bubble_bubble |
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
FROM ruby:3.0 | |
# Add nodejs to apt package manager | |
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - | |
# Install nodejs | |
RUN apt-get install -y nodejs | |
# Install Yarn | |
RUN npm install --global yarn |
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
from concurrent.futures import ThreadPoolExecutor | |
import concurrent.futures | |
import time | |
import logging | |
from datetime import datetime, date | |
import pandas as pd | |
from itertools import count | |
from panopto_soap import ( |
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
import concurrent.futures | |
def cancel_further_threads(self, futures, number_of_finished_page): | |
for fut, page in futures.items(): | |
if page > number_of_finished_page: | |
fut.cancel() | |
return futures |
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 Pager: | |
"""Iterator that returns the next n numbers as a list.""" | |
def __init__(self, set_size=10): | |
self.set_size = set_size | |
self.start = 1 | |
def __iter__(self): | |
return self |
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 | |
yum update -y | |
yum -y install git | |
pip install ansible | |
mkdir /etc/ansible | |
touch /etc/ansible/hosts | |
echo localhost >> /etc/ansible/hosts | |
runuser -l ec2-user -c 'ansible-galaxy install rvm_io.ruby' |
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
--- | |
# ansible-pull -U https://gist.githubusercontent.com/RyanSnodgrass/92d91e7262d788a9a2abdab6da3126f2 ec2-ansible-playbook.yml | |
- | |
hosts: all | |
roles: | |
- | |
role: rvm_io.ruby | |
rvm1_install_flags: --auto-dotfiles | |
rvm1_install_path: /usr/local/rvm | |
rvm1_rubies: |
NewerOlder