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
| ////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| // Part 1: Media Recorder // | |
| ////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| const blobs = []; | |
| let recorder; | |
| async function startRecording() { | |
| const stream = await navigator.mediaDevices.getUserMedia({ audio: 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
| def mergeSort(arr) | |
| return arr if arr.length < 2 | |
| newArr = [] | |
| mid = arr.length / 2 | |
| merge mergeSort(arr[0...mid]), mergeSort(arr[mid..-1]) | |
| end | |
| def merge(arr1, arr2) |
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 bubbleSortProc(arr, proc=Proc.new {|x, y| x > y }) #add optional proc arg | |
| #iterates through the array, inspecting two adjacent elements and swapping place based on the sorting algorithm | |
| return arr if arr.count < 2 | |
| (arr.length - 1).times do |i| | |
| x, y = arr[i], arr[i+1] | |
| if proc.call(x, y) | |
| arr[i+1], arr[i] = x, y | |
| end | |
| end |