Skip to content

Instantly share code, notes, and snippets.

View patrickclery's full-sized avatar

Patrick Clery patrickclery

View GitHub Profile
@patrickclery
patrickclery / scratch_7.rb
Created December 28, 2019 22:52
Write a Ruby program to output the lowest 10 positive integers where the sum of the digits of each integer equals 10 and that contain the number 7 as one of the digits. For instance: The integer 1171 - its digits add up to 10 and it contains a 7
###############################################################################
# Write a Ruby program to output the lowest 10 positive integers where the sum of the digits of each integer equals 10 and that contain the number 7 as one of the digits. For instance: The integer 1171 - its digits add up to 10 and it contains a 7
class App
def self.call
found_numbers = []
1.upto(Float::INFINITY) do |num|
next unless num.to_s.match(/7/)
found_numbers << num if num.to_s.split('').map(&:to_i).sum === 10
break if found_numbers.size == 10
@patrickclery
patrickclery / docker-compose.yml
Last active April 17, 2019 05:13
docker-compose.yml snippets
aptcache:
container_name: aptcache
hostname: aptcache
image: sameersbn/apt-cacher-ng:3.1-2
networks:
- razornet
ports:
- 3142:3142
restart: always
@patrickclery
patrickclery / .gitignore
Created December 26, 2018 22:26
.gitignore for Rails Projects
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Gem related
@patrickclery
patrickclery / github_guide.md
Last active April 30, 2020 13:34
Behavior-Driven Development Workflow on Github

TL;DR

(Everything you need to know about Behavior Driven Development on Github can be summed up in this snippet of code.)

RSpec.describe Ticket, type: :model do

  it { should validate_presence_of :issue }
  it { should validate_presence_of :pseudo_code }
 it { should be_designated_a(Priority) }
### PR Checklist
- [ ] **Review code coverage report (CodeCov)**
* Has coverage gone up or down with this feature?
* Do we need to add or update tests?
- [ ] **Merge from dev to feature branch** and resolve any merge conflicts
- [ ] **Review CodeClimate** report and improve where possible