This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains hidden or 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() | |
{ | |
function unaryCall(arg) | |
{ | |
this.args = []; | |
return arg; | |
} | |
function partialise(initialFunction) | |
{ |
This file contains hidden or 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 multiply(a, b) | |
{ | |
let am = a.match(/^(-?)(\d+)(([.])(\d+))?$/) | |
if(am === null) | |
{ | |
throw `Format Error: ${a} is not a valid number` | |
} | |
let bm = b.match(/^(-?)(\d+)(([.])(\d+))?$/) | |
if(bm === null) |
This file contains hidden or 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 ordinalSuffix(n) | |
{ | |
let units = n % 10; | |
let tens = n % 100; | |
let ord = (units > 3 || units < 1) || (tens > 10 && tens < 20) ? 'th' : (units == 1 ? 'st' : (units == 2 ? 'nd' : 'rd')); | |
return ord; | |
} |
This file contains hidden or 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 areSameWeeksUTC(date1, date2, boundaryDay=0) | |
{ | |
if(date1 > date2) | |
{ | |
let t = date1; | |
date1 = date2; | |
date2 = t; | |
} | |
if(((((date2 - date1)/1000)/3600)/24)>6) |
This file contains hidden or 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
// ==UserScript== | |
// @name dev.to spam filter | |
// @version 1 | |
// @include http* | |
// @match *://dev.to/* | |
// @grant none | |
// @run-at document-end | |
// ==/UserScript== | |
const dev_posts = document.body; |
This file contains hidden or 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 timeit(fn, count, pars) | |
{ | |
performance.measure('start'); | |
for(let i = 0; i < count; i++) | |
{ | |
fn(...pars); | |
} | |
performance.measure('end'); | |
starts = performance.getEntriesByName('start') | |
ends = performance.getEntriesByName('end') |
This file contains hidden or 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
#! /usr/bin/env python | |
from urllib.request import urlopen, Request | |
import urllib | |
import base64 | |
from bs4 import BeautifulSoup | |
import os.path | |
import time | |
import smtplib | |
def main(): |
This file contains hidden or 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
VALUE_ORDER = ['2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'] | |
class PokerHand: | |
def __init__(self, cards): | |
self.cards = [] | |
self.rankName = '' | |
self.original = cards | |
for card_str in cards: | |
self.cards.append(Card(card_str.upper())) | |
self.highest = self.cards[0] |
This file contains hidden or 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 Asteroid(position) | |
{ | |
this.position = position; | |
this.slopes = new Map(); | |
} | |
Asteroid.prototype.slopeAndDistance = function(other) | |
{ | |
let xdiff = (other.position.x - this.position.x); | |
let ydiff = (other.position.y - this.position.y); |
NewerOlder