Skip to content

Commit

Permalink
+++
Browse files Browse the repository at this point in the history
  • Loading branch information
Offirmo committed Sep 22, 2024
1 parent d312df4 commit 446fd8e
Show file tree
Hide file tree
Showing 16 changed files with 216 additions and 81 deletions.
3 changes: 2 additions & 1 deletion stack--current/1-stdlib/ts--types/src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { IETFLanguageType } from './international.js'
// REFINED in @offirmo-private/ts-types-web

export type Emoji = string
export type Url‿str = string
export type Uri‿str = string
export type Url‿str = Uri‿str
export type Email‿str = string

export interface SocialNetworkLink {
Expand Down
28 changes: 23 additions & 5 deletions stack--current/3-advanced--multi/rich-text-format/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
A generic, platform independent rich text format.

It's half-way between raw text and html. It has only 1 dimension.
A generic, platform-independent, rich text format

Can be rendered in ascii, html, react...
The goal is to
- be semantic
- be render-able in both terminal and browser = ascii, html, react...

This format is half-way between raw text and html, a bit similar to Markdown.

It has only 1 dimension (flow) but hints can be added to render in a more fancy way if supported. Ex. a "ul/ol" hint.

It has an underlying JSON structure. See `/demos/*`

A notable difference with other document formats (Atlassian, Slack...) is that we don't have an array of children.
Instead, a text with references to other nodes is used. Advantages:
- a bit more readable
- we can re-use nodes
- we can over-supply nodes and not always use them
Disadvantages
- verbose for lists

See /demos/*

```js
import * as RichText from '@offirmo-private/rich-text-format'
Expand All @@ -24,7 +38,7 @@ console.log(RichText.renderⵧto_actions($doc))
```

Inspiration:
* "Atlassian Document Format" https://bitbucket.org/atlassian/adf-builder-javascript#readme
* "Atlassian Document Format" https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/

Related, discovered after I made mine:
* Slack's "block kit" https://api.slack.com/block-kit
Expand All @@ -35,3 +49,7 @@ Related, discovered after I made mine:
Tosort
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl
* https://formatjs.io/docs/core-concepts/icu-syntax/


TODO add emoji support
TODO add hypermedia as first class?
75 changes: 2 additions & 73 deletions stack--current/3-advanced/ts--types--web/src/01-links/index.ts
Original file line number Diff line number Diff line change
@@ -1,73 +1,2 @@


import type {
Url‿str as SimplerUrl‿str,
SocialNetworkLink as SimplerSocialNetworkLink,
} from '@offirmo-private/ts-types'

import { WithLang } from '../00-base/index.js'

/////////////////////////////////////////////////

type Url‿str = SimplerUrl‿str
// protocol

////////////

type SocialNetworkId =
| 'artstation'
| 'facebook'
| 'github'
| 'instagram'
| 'itch.io' // https://itch.io/profile/xyz
| 'linkedin'
| 'producthunt'
| 'reddit'
| 'twitch'
| 'ko-fi' // https://ko-fi.com/xyz
| 'twitter' // we keep "twitter" as an internal id, "X" is too generic

interface SocialNetworkLink extends SimplerSocialNetworkLink {
url: Url‿str // mandatory
handle?: string // ex @Offirmo, u/Offirmo
network: SocialNetworkId // helps to parse. Not optional bc I can add if missing
}

////////////

// TODO new Url spec
// https://en.wikipedia.org/wiki/Wikipedia:Bare_URLs
// https://en.wikipedia.org/wiki/Wikipedia:Link_rot
// TODO https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007899
// skip link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#skip_links
interface Link extends WithLang {
// do we endorse this link?
// should we add ref?
// follow?
// etc...

// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
// download
// href
// ping
// referrer policy
// target...
// attribution https://wicg.github.io/attribution-reporting-api/?sjid=5871821160398133867-AP#monkeypatch-attributionsrc

/*
Using target="_blank" without rel="noreferrer" and rel="noopener" makes the website vulnerable to window.opener API exploitation attacks,
although note that, in newer browser versions setting target="_blank" implicitly provides the same protection as setting rel="noopener".
See browser compatibility for details.
(beware Android WebView!)
*/
}

/////////////////////////////////////////////////

export {
type Url‿str,
type SocialNetworkId,
type SocialNetworkLink,

type Link,
}
export * from './types.js'
export * from './selectors.js'
24 changes: 24 additions & 0 deletions stack--current/3-advanced/ts--types--web/src/01-links/selectors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import assert from 'tiny-invariant'


import type { URI‿x, SchemeSpecificURIPart } from './types.js'


/////////////////////////////////////////////////

function getꓽscheme_specific_partⵧfrom_URLObject(url: URL): SchemeSpecificURIPart {
throw new Error(`NIMP!`)
}

function getꓽscheme_specific_part(link: URI‿x): SchemeSpecificURIPart {
if (typeof link !== 'string')
return link

return getꓽscheme_specific_partⵧfrom_URLObject(new URL(link))
}

/////////////////////////////////////////////////

export {
getꓽscheme_specific_part
}
116 changes: 116 additions & 0 deletions stack--current/3-advanced/ts--types--web/src/01-links/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import type {
SocialNetworkLink as SimplerSocialNetworkLink,
} from '@offirmo-private/ts-types'

import { WithLang } from '../00-base/index.js'

/////////////////////////////////////////////////

type Uri‿str = string
type Url‿str = Uri‿str

////////////

type SocialNetworkId =
| 'artstation'
| 'facebook'
| 'github'
| 'instagram'
| 'itch.io' // https://itch.io/profile/xyz
| 'linkedin'
| 'producthunt'
| 'reddit'
| 'twitch'
| 'ko-fi' // https://ko-fi.com/xyz
| 'twitter' // we keep "twitter" as an internal id, "X" is too generic

interface SocialNetworkLink extends SimplerSocialNetworkLink {
url: Url‿str // mandatory
handle?: string // ex @Offirmo, u/Offirmo
network: SocialNetworkId // helps to parse. Not optional bc I can add if missing
}

////////////

interface SchemeSpecificURIPart {
// TODO clarify encoding

// authority: not needed for now

/** Core property
*/
path: string

/** (optional) non-hierarchical data
* https://en.wikipedia.org/wiki/Query_string
* - The exact structure of the query string is not standardized. Methods used to parse the query string may differ between websites.
* NOTE: in-scope of the scheme
* * considered "unclean", try to not abuse
* NOT necessarily a key/value store
*/
query: string // TODO or query params or anything

/** (optional) sub-resource identifier, sub-set, portion of the primary rsrc or view = representation the resource
* https://en.wikipedia.org/wiki/URI_fragment
* recommended to only use when it's not practical to serve the sub-rsrc independently https://www.w3.org/TR/cooluris/
* NOTE: independent of the scheme
* ex. :~:text=whatever
*/
fragment?: string

/** (optional) the immediate parent in the cascade. Useful to resolve the full URI IF NEEDED
* TODO clarify how to set a "encapsulating URI" for properly detecting and resolving relative URIs
*/
parent?: SchemeSpecificURIPart
}

type URI‿x = Uri‿str | SchemeSpecificURIPart

/////////////////////////////////////////////////

type LinkRelation = string

/** A more generic hyperlink than HTML's <a>
* following hypermedia theory
*/
interface Hyperlink extends WithLang {
href: URI‿x

/**
* https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
*/
rel: LinkRelation[] // https://www.iana.org/assignments/link-relations/link-relations.xhtml

cta?: string // if present, replace / complement the anchor content

target?: never // TODO clarify

// referrer TODO
// opener TODO

// do we endorse this link?
// should we add ref?
// follow?
// etc...

// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
// download
// href
// ping
// referrer policy
// attribution https://wicg.github.io/attribution-reporting-api/?sjid=5871821160398133867-AP#monkeypatch-attributionsrc
}

/////////////////////////////////////////////////

export {
type Url‿str,

type SocialNetworkId,
type SocialNetworkLink,

type URI‿x,
type SchemeSpecificURIPart,
type LinkRelation,
type Hyperlink,
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ changelog -- conventional https://github.com/conventional-changelog
changelog -- standard https://keepachangelog.com/ https://common-changelog.org/
CI (Continuous Integration) https://www.browserstack.com/guide/difference-between-continuous-integration-and-continuous-delivery
class
clever code considered harmful https://www.joshwcomeau.com/career/clever-code-considered-harmful/
client/server -- multi-tier architecture
close / destroy / terminate / dispose / release / free / delete / destruct / finalize / teardown / cleanup / shutdown / stop / end / abort / cancel / halt / kill / exit / quit / unload / dispose...
code is the enemy = It can go wrong, and it needs maintenance. Write less code. Delete code. Don’t write code you don’t need https://opensource.com/article/17/5/30-best-practices-software-development-and-testing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ CSS -- width = auto, fit-content, min-content https://courses.joshwcomeau.com/cs
CSS -- z-index
CSS -- zoom https://www.oddbird.net/2024/07/09/zoomies/
CSS https://developer.mozilla.org/en-US/docs/Learn/CSS/First_steps/Getting_started
dark patterns https://www.uxtigers.com/post/dark-design
data fetching https://martinfowler.com/articles/data-fetch-spa.html
design -- guides https://owickstrom.github.io/the-monospace-web/
devices -- support
Expand Down Expand Up @@ -134,9 +135,11 @@ GraphQL
GraphQL -- against https://bessey.dev/blog/2024/05/24/why-im-over-graphql/
HTML -- concepts
HTML -- elements
html -- first https://html-first.com/
html -- metadata https://github.com/wikimedia/html-metadata
HTML -- tags
htmx https://htmx.org/
hypercard https://hypercard.org
hypermedia
hypertext
i18e Ecosystem Performance = Cleanup, Speedup, Levelup. One Package at a time. https://e18e.dev/
Expand Down Expand Up @@ -209,6 +212,7 @@ response times https://www.nngroup.com/articles/response-times-3-important-limit
security -- clickjacking https://portswigger.net/web-security/clickjacking
security -- cross-site leaks https://xsleaks.dev/
security -- in-app browsers https://krausefx.com/blog/ios-privacy-instagram-and-facebook-can-track-anything-you-do-on-any-website-in-their-in-app-browser
spirit -- view source affordance https://htmx.org/essays/right-click-view-source/
SSR good explanation https://single-spa.js.org/docs/ssr-overview/
temporal dead zone (TDZ) https://devdocs.io/javascript/statements/let#temporal_dead_zone_tdz
testing -- component https://storybook.js.org/blog/component-testing/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ enterprise -- cross-orgs (shared channels)
enterprise -- data residency
enterprise -- drafts
enterprise -- personal workspace = to use the feature for themselves
enterprise -- regulated industries
enterprise -- security
enterprise -- similar
enterprise -- SSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[ ] https://carloarg02.medium.com/how-i-scaled-amazons-load-generator-to-run-on-1000s-of-machines-4ca8f53812cf
[ ] https://medium.com/@sureshpodeti/system-design-twitter-a98e7d134634
[ ] https://newsletter.pragmaticengineer.com/p/building-the-threads-app
[ ] https://slack.engineering/scaling-datastores-at-slack-with-vitess/
[ ] https://www.infoq.com/news/2024/01/discord-midjourney-performance/
[ ] https://www.youtube.com/watch?v=paTtLhZFsGE
[ ] kubernetes
Expand All @@ -26,7 +27,6 @@
[ ] real case https://deno.com/blog/how-we-built-jsr
[ ] research papers: https://medium.com/@rohitverma_87831/my-interview-experience-at-google-afc1080df175
[ ] Software Engineering Advice from Building Large-Scale Distributed Systems
[ ] https://slack.engineering/scaling-datastores-at-slack-with-vitess/
access control
ACID -- 1 Atomicity = transactions are "all or nothing"
ACID -- 2 Consistency = integrity constraints: "valid state" before AND after a transaction
Expand Down Expand Up @@ -118,6 +118,7 @@ cloud native = leverages the full capabilities of the cloud, beyond storage and
compliance
compute
confidentiality
config -- drift https://score.dev/
consistent Hashing
containers
containers -- images -- golden = pre-configured and optimised container images that serve as standardised and reusable foundations for building other images (apps, services...)
Expand Down Expand Up @@ -458,3 +459,4 @@ well architected -- pillar -- performance efficiency = using IT and computing re
well architected -- pillar -- reliability = consistently and correctly perform intended functions, Recover from infrastructure or service disruptions, Dynamically acquire computing resources to meet demand, Mitigate disruptions such as misconfigurations or transient network issues -- includes testing recovery procedures, scaling horizontally to increase aggregate system availability, and automatically recovering from failure.
well architected -- pillar -- security = protecting information, systems, and assets while delivering business value through risk assessments and mitigation strategies -- Automate security best practices when possible, Apply security at all layers, Protect data in transit and at rest.
well architected -- pillar -- sustainability = minimizing the environmental impact of your technology -- Understand your impact, Establish sustainability goals, Maximize utilization, Anticipate and adopt new, more efficient hardware and software offerings, Use managed services, Reduce the downstream impact of your cloud workloads
workload https://score.dev/
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
[ ] https://amir.rachum.com/mental-models/
[ ] https://boz.com/
[ ] https://en.wikipedia.org/wiki/Power_(social_and_political)
[ ] https://paulgraham.com/faq.html
[ ] https://perell.com/essay/50-ideas-that-changed-my-life/
[ ] https://www.ted.com/playlists/171/the_most_popular_ted_talks_of_all_time
[ ] wish I knew https://medium.com/mind-cafe/cheat-codes-for-life-i-know-at-36-that-i-wish-i-knew-at-26-294f6e865db5
Expand Down Expand Up @@ -279,6 +280,7 @@ pretty privilege -> karen
primals https://myprimals.com https://templetonreligiontrust.org/explore/discovering-peoples-primal-world-beliefs/
priming
principal-agent problem https://en.wikipedia.org/wiki/Principal–agent_problem
Principle of Least Power
Prisoner's dilemma https://en.wikipedia.org/wiki/Prisoner%27s_dilemma
prix au kilo
problem solving -- structured https://strategyu.co/mckinsey-structured-problem-solving-secrets/
Expand Down Expand Up @@ -380,6 +382,7 @@ trust -- trust, but verify
truth -- fully convinced vs probably https://christianity.stackexchange.com/questions/92352/believing-that-christianity-is-probably-true-vs-being-fully-convinced-that-ch
truth -- verificationism https://christianity.stackexchange.com/a/89891
unlearn
vanilla
verifiability https://en.wikipedia.org/wiki/Wikipedia:Verifiability
via Negativa = When we have a problem, our natural instinct is to add a new habit or purchase a fix. But sometimes, you can improve your life by taking things away. For example, the foods you avoid are more important than the foods you eat.
voleur volé
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ https://www.researchgate.net/publication/324329159_How_Constraints_Affect_Conten


diagrams https://d2lang.com/

https://viz-js.com/

## Need for a long-term semantic format

Expand All @@ -35,6 +35,8 @@ https://en.m.wikipedia.org/wiki/BBC_Domesday_Project
https://www.canvasprotocol.org/


https://www.notion.so/blog/data-model-behind-notion


## hierarchy of file formats

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

https://datatracker.ietf.org/doc/html/rfc8615
- registry: https://www.iana.org/assignments/well-known-uris/well-known-uris.xhtml


TODO https://llmstxt.org/
Loading

0 comments on commit 446fd8e

Please sign in to comment.