Skip to content

Instantly share code, notes, and snippets.

View netsprout's full-sized avatar
🌻
Working on automating my food computer...

Aaron Fry netsprout

🌻
Working on automating my food computer...
View GitHub Profile
@netsprout
netsprout / closures.rb
Created March 26, 2019 18:00
Fun with Ruby Closures
def aclosure(outer)
-> (inner) {inner + outer}
end
add3 = aclosure(3)
add10 = aclosure(10)
puts add3.call(5)
puts add10.call(5)
@netsprout
netsprout / bubble_sort.rb
Last active August 5, 2020 05:48
My bubble sort
#!/bin/ruby
require 'json'
require 'stringio'
def count_swaps(sort_me)
is_sorted = false
swap_count = 0
while is_sorted == false