Skip to content

Instantly share code, notes, and snippets.

(function () {
const initialTeams = Array.prototype.slice.call(document.querySelectorAll('#schedsubnav li'));
const scores = [];
// gets results based on what is displayed, clicks to change selected team need to happen before this
const getResults = () => {
const res = document.querySelectorAll('table.Table.Table-interactive tbody tr');
const arr = Array.prototype.slice.call(res);
return arr.map(row => {
const score = row.querySelector('td span.yfa-score').textContent;
@TGOlson
TGOlson / scraper.js
Last active August 17, 2019 15:31
yahoo draft value scraper
// setup
// install if you don't have the below packages already
//
// $ npm install node-fetch --save
// $ npm install jsdom --save
// imports
const fs = require('fs');
const fetch = require('node-fetch');
const jsdom = require("jsdom");
(async function() {
// Volume,Symbol,Date Acquired,Date Sold,Proceeds,Cost Basis,Gain,Currency
const csv = [];
const formatDate = dateStr => dateStr.slice(5).replace('-', '/') + '/' + dateStr.slice(0, 4);
const rows = csv.map(row => {
const [volume, symbol, acquired, sold, proceeds, costBasis, gain, currency] = row.split(",");
const description = `${volume} ${symbol}`;
var Path = require('path');
var getRegCommand = function() {
var command = 'reg.exe';
if (process.env.SystemRoot) {
command = Path.join(process.env.SystemRoot, 'System32', command);
}
return command;
}
function test() {
var ids = getIds();
var batches = createBatches(ids);
for (var id in batches) {
if (batches.hasOwnProperty(id)) {
var pages = batches[id];
var start = pages[0];
var end = pages[pages.length -1];
@TGOlson
TGOlson / baz-types.js
Last active September 26, 2017 16:11
FlowType from Haskell type hack
/* @flow */
export type Baz = {
bar: number;
baz: Array<string>;
};
@TGOlson
TGOlson / func_validations.js
Last active September 26, 2017 16:10
Functional validations
var Validator = require('simple-validate');
var validateTenantArgs = Validator.validateOrThrow({
title: 'somePred',
etc: '...'
});
// current style
function postTenantToSystemTenant(systemTenant, tenantArgs) {
validateTenantArgs(tenantArgs);
/*
* Thread configuration for each thread. Make sure it matches the number above.
* low_power_mode - This mode will double the cache usage, and double the single thread performance. It will
* consume much less power (as less cores are working), but will max out at around 80-85% of
* the maximum performance.
*
* no_prefetch - Some sytems can gain up to extra 5% here, but sometimes it will have no difference or make
* things slower.
*
* affine_to_cpu - This can be either false (no affinity), or the CPU core number. Note that on hyperthreading
hasMatchingBrackets :: String -> Bool
hasMatchingBrackets = fst . foldr reducingFn (True, mempty)
where
reducingFn _ (False, xs) = (False, xs) -- short circuit if already false
reducingFn char (True, tokens) | char `elem` openingTokens = (True, char : tokens)
reducingFn char (True, []) | char `elem` closingTokens = (False, [])
reducingFn char (True, x:xs) | char `elem` closingTokens = if isClosingToken x char then (True, xs) else (False, x:xs)
reducingFn _ st = st
tokenPairs :: [(Char, Char)]
var DCData = { /* ... */ }
var TestData = { /* ... */ }
var PanelCodes = {
"LABS, Inc": {
"CT Panel": "3328",
"WU Panel": "3223"
},
"ViroMed Laboratories": {
"CT Panel": "139467",