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
/// Usage: =getStockPrice("AAPL") | |
/// Returns: 150.00 | |
function getStockPrice(ticker) { | |
const stockURL = "https://ws-api.iextrading.com/1.0/stock/"; | |
var response = UrlFetchApp.fetch(stockURL + ticker + "/price"); | |
return JSON.parse(response); | |
} | |
/// Usage: =getStockChangePercent("AAPL") | |
/// Returns: "1.0%" |
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
- (NSArray *)mergeSort:(NSArray *)array { | |
if (array.count == 1) { | |
return array; | |
} | |
// Split array in two | |
NSInteger firstHalfCount = array.count/2; | |
NSInteger secondHalfCount = array.count - firstHalfCount; | |
NSArray *arrayOne = [array subarrayWithRange:NSMakeRange(0, firstHalfCount)]; |
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
- (NSArray *)quickSortWithArray:(NSArray *)array { | |
if (array.count == 0) { | |
return array; | |
} | |
// Use first item as pivot | |
NSNumber *pivot = array[0]; | |
// Creat temp arrays to hold values |