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
| // ==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 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
| 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 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() | |
| { | |
| 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
| <!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
| import json | |
| from uuid import uuid4 | |
| class Node: | |
| def __init__(self, coins, target, prev, coin): | |
| self.previous_node = prev | |
| self.target = target | |
| self.count = target+1 | |
| self.id = uuid4() | |
| self.coin = coin |
OlderNewer