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
def flatten(array) | |
out = [] | |
array.each do |el| | |
if el.is_a?(Array) | |
out.concat(flatten(el)) | |
else | |
out.push(el) | |
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
- (void)moveBar:(Bar *)bar toBarNumber:(int)barNumber | |
{ | |
int index = [[self bars] indexOfObject:bar]; | |
NSLog(@"index of bar to move: %i", index); | |
MusicTimeStamp beatToMoveFrom = [Song beatNumberForBarNumber:index+1]; | |
MusicTimeStamp beatEndTime = beatToMoveFrom + 4; | |
MusicTimeStamp beatToMoveTo = [Song beatNumberForBarNumber:barNumber]; | |
NSLog(@"beatToMoveFrom: %f, beatEndTime: %f, beatToMoveTo: %f", beatToMoveFrom, beatEndTime, beatToMoveTo); |