Preferred shebang
#!/usr/bin/env bash
function processData(input) { | |
var tokenized = input.split("\n").slice(1).map(function(current) { return current.split(/\s/); }), count = 0; | |
var l2R = tokenized.reduce(function(total, current) { return Number(total) + Number(current[count++]); }, 0); | |
var r2L = tokenized.reduce(function(total, current) { return Number(total) + Number(current[--count]); }, 0); | |
console.log(Math.abs(l2R -r2L)); | |
} |
Preferred shebang
#!/usr/bin/env bash
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " |
### Keybase proof | |
I hereby claim: | |
* I am asimpletune on github. | |
* I am asimpletune (https://keybase.io/asimpletune) on keybase. | |
* I have a public key ASDJM-8dqDzyPa_Xp-S7mCTbdmY-xomeTC87P4ux-n3KJgo | |
To claim this, I am signing this object: |
Changelog
v1.0.2 (2023-06-03)
v1.0.1 (2023-05-18)
{# The following is a shortcode that extracts parameters from a markdown-style image #} | |
{# The usage is as follows (`cite` is optional) #} | |
{# {{ fig(img='![alt](src "title")', cite='<a href="">author</a>, by source') }} #} | |
{# `title` will be reused as caption if it exists, if no `title` but there is `cite` then just "Citation:" will appear #} | |
{# NOTE: it's advised to just use backticks for passing arguments, so that single and double quotes don't cause issues, e.g. using a possesive apostrophe or quotes in a caption #} | |
{% set img_tag = img | markdown %} | |
{% set src = img_tag | split(pat="src") | nth(n=1) | split(pat='"') | nth(n=1) %} | |
{% set alt = img_tag | split(pat="alt") | nth(n=1) | split(pat='"') | nth(n=1) %} |
{# This macro will provide the canonical URL if running in production, see 'private' below #} | |
{%- macro cf_url_to_canonical() -%} | |
{{ self::cf_url_to_canonical_private() | trim }} | |
{%- endmacro -%} | |
{# Note: 'private' because this macro leaves space, so it's trimmed in the 'public' version #} | |
{% macro cf_url_to_canonical_private() %} | |
{# https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables #} | |
{% set CF_PAGES = get_env(name="CF_PAGES", default="0") %} |
{# | |
This macro is for removing desired html tags from markdown. You pass it literal text that is markdown, and it will remove the desired tags. There's an optional `allow_html` parameter that defaults to `false`. This controls whether to permit html that is mixed with markdown. | |
Note: you MUST store the result as a variable, before evaluating it as an expression, i.e. with the {{ }} syntax. | |
Otherwise, you will always get a string representation of the HTML. For some reason, saving the string, then evaluating | |
the expression doesn't have that issue. | |
TODO: file a bug. Case to reproduce is {{ filter_md(md, ["h1"]) }} does not work, but saving as a variable and then doing it does. | |
#} | |
{% macro filter_md(md, allow_html=false, disallow) %} |
async function errorHandling(context) { | |
try { | |
return await context.next(); | |
} catch (err) { | |
return new Response(`${err.message}\n${err.stack}`, { status: 500 }); | |
} | |
} | |
/** | |
* Parse HTTP Basic Authorization value. |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>Semantic HTML for "reader mode"</title> | |
<meta name="description" content="For an example visit https://spenc.es/writing"> | |
</head> | |
<body> | |
<header> |