Opinionated Template
npx degit https://gist.github.com/5a48a8afd9377b0dd3523f68af512f98.git my-new-worker
mkdir src; mv _src_worker.ts src/worker.ts
npm install
*.zst | |
*.rpm | |
*.deb | |
*.html |
import path from 'node:path' | |
import fs from 'node:fs/promises' | |
const sourceDirectory = './Keep' | |
const destDirectory = './Markdown' | |
const attachmentsDirectory = './Markdown/Attachments' | |
const filenames = await fs.readdir(sourceDirectory) | |
const formatTag = (s = '') => | |
s |
module Domain | |
open Fable.Core | |
open Fable.Import | |
open System | |
// type Guid = Guid of string | |
type NoneEmptyString = private NoneEmptyString of string |
const { spawn } = require('child_process') | |
const argument = { | |
width: 500, | |
height: 300, | |
x: 100, | |
y: 100, | |
} | |
/* |
/** | |
* Needs MP4Box binary to work | |
* $> node split.js "Atomic Habits.m4b" | |
*/ | |
const { execSync, exec } = require('child_process') | |
const cheerio = require('cheerio') | |
const escape = string => | |
string | |
.split('') |
const { ApolloServer, gql } = require('apollo-server-cloudflare') | |
const { | |
graphqlCloudflare, | |
} = require('apollo-server-cloudflare/dist/cloudflareApollo') | |
const typeDefs = gql` | |
type Query { | |
hello: String | |
} | |
` |
JSON.parse(JSON.stringify())
is not really fast or efficient, but stringify
has convenient replacer parameter
Useful for converting request query values to integers and booleans
Lets say you have lots of stuff in query
app.get('/query', (req, res) => res.send(req.query))
app.get('/infer', (req, res) => res.send(inferValues(req.query)))
dateFormat(input) { | |
const date = new Date(input) | |
const timeString = date.toLocaleTimeString(['uk-UA'],{ | |
hour12: false, | |
hour: '2-digit', | |
minute: '2-digit' | |
}) | |
const dateString = date | |
.toLocaleDateString(['uk-UA'], { | |
month: '2-digit', |