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
javascript: Promise.all([import('https://unpkg.com/[email protected]?module'), import('https://unpkg.com/@tehshrike/[email protected]'), ]).then(async ([{ | |
default: Turndown | |
}, { | |
default: Readability | |
}]) => { | |
/* Optional vault name */ | |
const vault = ""; | |
/* Optional folder name such as "Clippings/" */ |
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
console.log(Number(Math.round(1.005 + "e2") + "e-2")) // 1.01 | |
const roundAccurately = (number, decimalPlaces) => Number(Math.round(number + "e" + decimalPlaces) + "e-" + decimalPlaces) | |
console.log(roundAccurately(1.005, 2)) // 1.01 |
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
CREATE OR REPLACE FUNCTION jsonb_remove_keys( | |
jdata JSONB, | |
keys TEXT[] | |
) | |
RETURNS JSONB AS $$ | |
DECLARE | |
result JSONB; | |
len INT; | |
target TEXT; |
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
#!/usr/local/bin/planck | |
(ns eqt.core | |
(:require [cljs.pprint :refer [pprint]] | |
[cljs.reader :as edn] | |
[planck.core :as planck] | |
[clojure.string :as string] | |
[cognitect.transit :as transit])) | |
(->> (repeatedly planck/read-line) |
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
var allDone = function(done){ // takes a callback that will be called as callback(errors, values) when all async parallel operations are finished. | |
var context = {task: {}, data: {}}; | |
context.end = function(e,v){ return done(e,v), done = function(){} }; // this can always be called if you want to terminate early, like because an error. | |
context.add = function(fn, id){ // if the async operation you are doing replies with standard fn(err, value) then just pass in a string ID, else your own callback and ID. | |
context.task[id = (typeof fn == 'string')? fn : id] = false; | |
var next = function(err, val){ | |
context.task[id] = true; // good, we're done with this one! | |
if(err){ (context.err = context.err || {})[id] = err } // record errors. | |
context.data[id] = val; // record the values. | |
for(var i in c.task){ if(c.task.hasOwnProperty(i)){ // loop over the async task checker |