Skip to content

Instantly share code, notes, and snippets.

class Array
def merge_sorted(other)
i = 0
j = 0
sorted = []
while(i < self.length || j < other.length) do
l = self[i]
m = other[j]
if l.nil? || l >= m
sorted << m
# Generate a random hex token with 256 bits, turn it into raw bytes
require 'jwt'
irb(main):013:0> token = rand(2**256).to_s(16)
irb(main):014:0> token
=> "625e3c0b7ed292952988ff403885d6a5718370a13625473984f152606a82e47e"
irb(main):015:0> [token].pack("H*")
=> "b^<\v~\xD2\x92\x95)\x88\xFF@8\x85\xD6\xA5q\x83p\xA16%G9\x84\xF1R`j\x82\xE4~"
irb(main):016:0> [token].pack("H*")
@pcorliss
pcorliss / yahoo-pre-draft.js
Created September 8, 2021 16:16
Populates Yahoo's Pre-Draft Rankings with a CSV
// 1. Download CSV of Fantasy Pros Draft Rankings https://www.fantasypros.com/nfl/rankings/half-point-ppr-cheatsheets.php
// 2. Paste into rankingCSV below
// 3. Navigate to Edit Pre-Draft Rankings Page on Yahoo
// 4. Paste below into Chrome Console
// 5. Wait for All Players to be loaded (951)
// 6. Run go()
// 7. Wait about an hour
// 8. Save Changes
(function loadPlayers() {
{"label":"Stars","message":"524","schemaVersion":1,"color":"yellow"}
irb(main):035:0> s = Set.new
=> #<Set: {}>
irb(main):036:0> a = Set.new([1,2,3])
=> #<Set: {1, 2, 3}>
irb(main):037:0> b = Set.new([1,2,3])
=> #<Set: {1, 2, 3}>
irb(main):038:0> s.add(a)
=> #<Set: {#<Set: {1, 2, 3}>}>
irb(main):039:0> s.include?(b)
=> true