This file contains 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
module.exports = function() { | |
let request = require("request-promise"); | |
let stopFlag; | |
async function start() { | |
if(!this.oncomment) { | |
console.error("You must attach an oncomment handler (onerror handler is optional)."); | |
return; | |
} |
This file contains 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 createSparkline(values, width=200, height=80, color='rgb(120,120,120)', maxValue) { | |
maxValue = maxValue || Math.max(...values); | |
values = values.map(v => (v/maxValue)); //normalise | |
let canvas = document.createElement('canvas'); | |
canvas.width = width; | |
canvas.height = height; | |
var ctx = canvas.getContext('2d'); | |
ctx.fillStyle = color; | |
ctx.moveTo(canvas.width, canvas.height); | |
ctx.lineTo(0, canvas.height); |
This file contains 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
// Given a large input image, this script generates map tiles of 256*256px | |
// at power-of-2 zoom levels. It's not super efficient or anything, just a | |
// quickly hacked together script. | |
//Use the tiles in leaflet.js like this: | |
/* | |
<div id='map' style='height:100%;'></div> | |
<script> | |
var map = L.map('map', { | |
attributionControl: false |
This file contains 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
// only covers a small subset of the Map api! | |
// haven't debugged yet! | |
class BigMap { | |
constructor(iterable) { | |
if(iterable) throw new Error("haven't implemented construction with iterable yet"); | |
this._maps = [new Map()]; | |
this._perMapSizeLimit = 14000000; | |
this.size = 0; | |
} |
This file contains 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
// Notes: we need the `sourceTabUrl &&` before the URL check because chromebooks make weird requests that don't come from "real" tabs. | |
let accessHeaders = new Map(); | |
let tabIdToUrlMap = new Map(); | |
let requestListener = function (details) { | |
const accessControlRequestHeader = details.requestHeaders.find(elem => elem.name.toLowerCase() === "access-control-request-headers"); | |
if(accessControlRequestHeader) { | |
accessHeaders.set(details.requestId, accessControlRequestHeader.value); | |
} |
This file contains 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
// Only works for images hosted on the same domain unless CORs headers of image allow you to use it. | |
// Usage: | |
// let data = await getImageData("http://example.com/image.png"); | |
// Put it in a try/catch to handle errors or use await getImageData("...").catch(e => ...); | |
function getImageData(url) { | |
return new Promise((resolve, reject) => { | |
let img = new Image(); | |
img.onload = function() { | |
let canvas = document.createElement("canvas"); | |
canvas.width = img.width; |
This file contains 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
// Fixed by @weequ: https://github.com/anvaka/VivaGraphJS/pull/204/files | |
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Viva=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | |
/** | |
* This is an entry point for global namespace. If you want to use separate | |
* modules individually - you are more than welcome to do so. | |
*/ | |
This file has been truncated, but you can view the full file.
This file contains 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
[{"phrase":"A bad excuse is better than none","source":"https://www.learn-english-today.com/proverbs"},{"phrase":"A bad penny always turns up","source":"https://www.learn-english-today.com/proverbs"},{"phrase":"A bad tree does not yield good apples","source":"https://www.learn-english-today.com/proverbs"},{"phrase":"A bad workman blames his tools","source":"https://www.learn-english-today.com/proverbs"},{"phrase":"A barking dog seldom bites","source":"https://www.learn-english-today.com/proverbs"},{"phrase":"A bird in hand is worth two in a bush","source":"https://www.learn-english-today.com/proverbs"},{"phrase":"A black plum is as sweet as a white","source":"https://www.learn-english-today.com/proverbs"},{"phrase":"A book holds a house of gold","source":"https://www.learn-english-today.com/proverbs"},{"phrase":"A broken friendship may be soldered but will never be sound","source":"https://www.learn-english-today.com/proverbs"},{"phrase":"A burden of one's own choice is not felt","source":"https://www.learn-e |
This file contains 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
<script src="https://unpkg.com/[email protected]/dist/unbzip2-stream.min.js"></script> | |
<script> | |
async function loadBzipJson(url, cb) { | |
let text = ""; | |
let bz2 = window.unbzip2Stream(); | |
bz2.on('data', (d) => { | |
text += new TextDecoder('utf-8').decode(d); | |
while(text.includes("\n")) { | |
cb(JSON.parse(text.slice(0, text.indexOf("\n")))); | |
text = text.slice(text.indexOf("\n")+1); |
This file contains 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
{"10":9331,"11":3452,"12":3099,"13":1741,"14":1919,"15":3362,"16":4020,"17":4212,"18":1621,"19":1884,"20":12579,"21":1041,"22":1105,"23":1044,"24":1336,"25":2064,"26":797,"27":881,"28":844,"29":718,"30":3417,"31":1005,"32":855,"33":736,"34":671,"35":1088,"36":870,"37":594,"38":611,"39":487,"40":2369,"41":572,"42":588,"43":516,"44":655,"45":921,"46":496,"47":541,"48":762,"49":542,"50":4149,"51":584,"52":713,"53":535,"54":471,"55":694,"56":601,"57":501,"58":430,"59":482,"60":2207,"61":544,"62":408,"63":431,"64":627,"65":807,"66":570,"67":447,"68":468,"69":463,"70":1433,"71":420,"72":532,"73":376,"74":432,"75":862,"76":450,"77":463,"78":460,"79":372,"80":2025,"81":495,"82":443,"83":493,"84":416,"85":606,"86":445,"87":386,"88":493,"89":444,"90":1408,"91":521,"92":503,"93":460,"94":451,"95":600,"96":587,"97":549,"98":645,"99":8867,"be":129751,"ei":31624,"il":83287,"le":165234,"id":63569,"d ":470592," k":43419,"ki":45808,"iw":377,"wi":84647,"i ":154196," f":221481,"fe":45633,"er":346337,"rn":20542,"ns":64040,"se":1 |
OlderNewer