Skip to content

Instantly share code, notes, and snippets.

@danabrey
danabrey / dynasty-scout-tampermonkey-mfl.js
Created October 18, 2019 15:53
TamperMonkey DynastyScout extension for MFL
// ==UserScript==
// @name DynastyScout Opposition Rankings for MyFantasyLeague.com
// @version 0.1.1
// @namespace http://www.myfantasyleague.com
// @description Add DynastyScout.com opposition rankings to the Submit Lineup page on MFL
// @include http://www*.myfantasyleague.com/*/lineup*
// @require http://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// ==/UserScript==
(function() {
'use strict';
@danabrey
danabrey / configure-ohmyzsh.md
Last active March 5, 2019 15:42
Install and configure oh-my-zsh with git and svn plugins and autosuggestions/syntax highlighting

oh-my-zsh require the zsh shell, along with git for self-installation and updating and Powerline fonts for the git/Subversion prompt decoration:

sudo apt install curl git zsh fonts-powerline

Install oh-my-zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Basic config

@danabrey
danabrey / extract-player-names-from-espn-roster.js
Created February 12, 2019 22:14
Extract player names from an ESPN website roster page
$('.player-column__bio .link').map((i, e) => $(e).text()).get().filter((e) => e.length > 0).join('\n')
@danabrey
danabrey / tarlepp-repo-example.php
Created November 5, 2018 21:02
Example custom repository for Doctrine multiple repositories from slack chat
<?php
namespace App\Repository;
use App\Entity\YourEntity;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
/**
* @method YourEntity|null find($id, $lockMode = null, $lockVersion = null)
SELECT uts.user_id, MIN(uts.ts) as earliest_action FROM (
SELECT user_id, MIN(placed) as ts FROM ADS WHERE user_id > 0 GROUP BY user_id UNION ALL
SELECT user_id, MIN(placed_on) as ts FROM reviews WHERE user_id > 0 GROUP BY user_id UNION ALL
SELECT EVENTS_user_xref.user_id as user_id, MIN(EVENTS.placed_time) as ts FROM EVENTS JOIN EVENTS_user_xref ON EVENTS.id = EVENTS_user_xref.event_id WHERE EVENTS_user_xref.user_id > 0 AND EVENTS.placed_time > 0 GROUP BY EVENTS_user_xref.user_id UNION ALL
SELECT EVENTS_user_xref.user_id as user_id, MIN(EVENTS_archive.placed_time) as ts FROM EVENTS_archive JOIN EVENTS_user_xref ON EVENTS_archive.id = EVENTS_user_xref.event_id WHERE EVENTS_user_xref.user_id > 0 AND EVENTS_archive.placed_time > 0 GROUP BY EVENTS_user_xref.user_id UNION ALL
SELECT user_id, UNIX_TIMESTAMP(MIN(time)) as ts FROM user_action_log WHERE time > 0 AND user_id > 0 GROUP BY user_id UNION ALL
SELECT user_id, MIN(time) as ts FROM email_mask_log WHERE time > 0 AND user_id > 0 GROUP BY user_id
)
<?php
class Car {
private $color = "red";
public function getColor()
{
return $this->color;
}
}
$start_time = microtime(TRUE);
<?php
class Car {
private $color = "red";
public function getColor()
{
return $this->color;
}
}
$start_time = microtime(TRUE);
try {
presidentialActivity();
} catch (e) {
tweet(generateRandomString() + " " + e + " Sad.";
}
@danabrey
danabrey / extract-mfl-matchups-plain-text.js
Created June 13, 2017 15:15
Extract matchups in plain text from MyFantasyLeague weekly matchups page
output = "";
$(".h2hmatchups.report").each(function() {
let $this = $(this);
$this.find("tr").each(function(el, i) {
output += $(this).text() + ((el%2==0) ? "\n" : " v ");
});
});
(function() {
'use strict';
var data = {};
var $rosterTableRows = $('#single_roster').find('table.report').find('tr');
var config = {
$tableHeaderRow: $rosterTableRows.slice(0,1),
$playerRows: $rosterTableRows.slice(1,-1),
currentYear: 2016,
maxContractYears: 5,
annualPlayerSalaryIncrease: 1.15,