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
Function LTGrowth(company As String, provider As String) As Double | |
Application.Volatile (False) | |
Dim address As String | |
Dim OpenTag, CloseTag, PreTag1, PreTag2 As String | |
Dim StartPos, InnerLen As Integer | |
If UCase(provider) = "MORNINGSTAR" Then | |
address = "http://financials.morningstar.com/valuation/forward-comparisons-list.action?&t=" & company & "®ion=usa&culture=en-US" |
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
function process(element){ | |
var text = element.innerText; | |
var pattern = /\((\d+):(\d{2})\)/; | |
var results = text.match(pattern); | |
if(results && results.length == 3) | |
return results[1]*60 + results[2]*1; | |
return 0; | |
} | |
links = document.getElementsByClassName("lecture-link"); |
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
function onOpen() { | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var searchMenuEntries = [{name: "Find Sheets", functionName: "search"}, | |
{name: "Aggregate Data", functionName: "aggregate"}]; | |
ss.addMenu("Aggregate", searchMenuEntries); | |
} | |
function search() { | |
// Get the active spreadsheet and the file list sheet | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); |
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
fields = ["FUND_CD","DEPT_CD","UNIT_CD","APPR_CD","OBJ_CD","SOBJ_CD","RSRC_CD","BSA_CD","LOC_CD","ACTV_CD","FUNC_CD","RPT_CD","MJR_PROG_CD","PROG_CD","PPC_CD","PHASE_CD","TASK_CD","STASK_CD",] | |
function camelize(str) { | |
return str.replace(/[_]+/g, ' ').toLowerCase().replace(/(?:^\w|[A-Z]|\b\w)/g, function(letter, index) { | |
return index == 0 ? letter.toLowerCase() : letter.toUpperCase(); | |
}).replace(/[\s]+/g, ''); | |
} | |
fields.forEach(function (field) { | |
var string = 'public string ' + camelize(field) + '\n' + |
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
//I was trying to do a Modulo sum, but this approach didn't work. | |
//I tried to take all the mod stuff out (I'm pretty sure it's a decent | |
//implementation of max subarray) but I may have missed something... | |
public static void log(Object message){ | |
System.out.println(message); | |
} | |
/* CLRS pg.71 | |
FIND-MAX-CROSSING-SUBARRAY(A, low, mid, high) |
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
/* | |
The dragon curve drawn using an L-system. | |
variables : X Y | |
constants : F + − | |
start : FX | |
rules : (X → X+YF+), (Y → -FX−Y) | |
angle : 90° | |
Here, F means "draw forward", − means "turn left 90°", and + means "turn right 90°". X and Y do not correspond to any drawing action and are only used to control the evolution of the curve. |
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
function printCodes(str) { | |
var result = ""; | |
for(var i = 0; i < str.length; i++){ | |
result += str.charCodeAt(i) + " "; | |
} | |
return result; | |
} |
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
modal = document.getElementsByClassName("modal")[0]; | |
document.body.removeChild(modal); | |
document.body.classList.remove("modal-open"); | |
upsell = document.getElementsByClassName("upsell")[0]; | |
upsell.parentElement.removeChild(upsell); | |
ps = document.getElementsByTagName('p'); | |
h2s = document.getElementsByTagName('h2'); | |
as = document.getElementsByTagName('a'); | |
for (i = 0; i < ps.length; i++) { |
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
function onOpen() { | |
var ui = SpreadsheetApp.getUi(); | |
ui.createMenu('Analysis') | |
.addItem('Generate Positions', 'genPositions') | |
.addToUi(); | |
} | |
function genPositions() { | |
var data = SpreadsheetApp.getActive().getSheetByName("data").getDataRange().getValues(); | |
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
//http://blog.mgechev.com/2012/11/24/javascript-sorting-performance-quicksort-v8/ | |
function swap(array, i, j) { | |
var temp = array[i]; | |
array[i] = array[j]; | |
array[j] = temp; | |
return array; | |
} | |
function partition(array, left, right, comparitor) { |
OlderNewer