Last updated: 9 Sep 23 16:47:08 (UTC)

Bear 4

Bear Test

#bear/welcome

Syntax Highlighting

Let’s see how it does at syntax highlighting. Wonder if I can hit backtick to render some code inline. Yup. And being able to hit triple backtick is also supported, like Slack, GitHub, etc. Unlike MS Teams.

TS

import { Translation } from "../utils/types.ts";

const Milestone = (props: { title: string; date: string; text?: string }) => (
  <div>
    <div class="flex justify-between md:flex-col">
      <h4 class="md:order-2">{props.title}</h4>
      <p class="md:order-1 md:mb-0.2">{props.date}</p>
    </div>
    {props.text && <p class="whitespace-pre-wrap">{props.text}</p>}
  </div>
);

const Education = (data: { translation: Translation["education"] }) => (
  <>
    <h3>{data.translation.title}</h3>
    <div class="space-y-3 lg:space-y-2">
      {data.translation.milestones.map((milestone) => (
        <Milestone {...milestone} />
      ))}
    </div>
  </>
);

export default Education;
import { Translation } from "../utils/types.ts";

const Milestone = (props: { title: string; date: string; text?: string }) => (
  <div>
    <div class="flex justify-between md:flex-col">
      <h4 class="md:order-2">{props.title}</h4>
      <p class="md:order-1 md:mb-0.2">{props.date}</p>
    </div>
    {props.text && <p class="whitespace-pre-wrap">{props.text}</p>}
  </div>
);

const Education = (data: { translation: Translation["education"] }) => (
  <>
    <h3>{data.translation.title}</h3>
    <div class="space-y-3 lg:space-y-2">
      {data.translation.milestones.map((milestone) => (
        <Milestone {...milestone} />
      ))}
    </div>
  </>
);

export default Education;

TSX

const Milestone = (props: { title: string; date: string; text?: string }) => (
  <div>
    <div class="flex justify-between md:flex-col">
      <h4 class="md:order-2">{props.title}</h4>
      <p class="md:order-1 md:mb-0.2">{props.date}</p>
    </div>
    {props.text && <p class="whitespace-pre-wrap">{props.text}</p>}
  </div>


const manifest = {
  routes: {
    "./routes/_app.tsx": $0,
    "./routes/_middleware.ts": $1,
    "./routes/about.tsx": $2,
    "./routes/api/mail.ts": $3,
    "./routes/colophon.tsx": $4,
    "./routes/index.tsx": $5,
    "./routes/privacy.tsx": $6,
  },
  islands: {
    "./islands/contact.tsx": $$0,
    "./islands/language.tsx": $$1,
  },
  baseUrl: import.meta.url,
};
const Milestone = (props: { title: string; date: string; text?: string }) => (
  <div>
    <div class="flex justify-between md:flex-col">
      <h4 class="md:order-2">{props.title}</h4>
      <p class="md:order-1 md:mb-0.2">{props.date}</p>
    </div>
    {props.text && <p class="whitespace-pre-wrap">{props.text}</p>}
  </div>
const Milestone = (props: { title: string; date: string; text?: string }) => (
  <div>
    <div class="flex justify-between md:flex-col">
      <h4 class="md:order-2">{props.title}</h4>
      <p class="md:order-1 md:mb-0.2">{props.date}</p>
    </div>
    {props.text && <p class="whitespace-pre-wrap">{props.text}</p>}
  </div>


const manifest = {
  routes: {
    "./routes/_app.tsx": $0,
    "./routes/_middleware.ts": $1,
    "./routes/about.tsx": $2,
    "./routes/api/mail.ts": $3,
    "./routes/colophon.tsx": $4,
    "./routes/index.tsx": $5,
    "./routes/privacy.tsx": $6,
  },
  islands: {
    "./islands/contact.tsx": $$0,
    "./islands/language.tsx": $$1,
  },
  baseUrl: import.meta.url,
};
const Milestone = (props: { title: string; date: string; text?: string }) => (
  <div>
    <div class="flex justify-between md:flex-col">
      <h4 class="md:order-2">{props.title}</h4>
      <p class="md:order-1 md:mb-0.2">{props.date}</p>
    </div>
    {props.text && <p class="whitespace-pre-wrap">{props.text}</p>}
  </div>
<?xml version="1.0" encoding="UTF-8"?>
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
<url>
  <loc>https://mooxl.dev/</loc>
  <lastmod>2022-10-01T22:00:05+00:00</lastmod>
  <priority>1.00</priority>
</url>
<url>
  <loc>https://mooxl.dev/imprint</loc>
  <lastmod>2022-10-01T22:00:05+00:00</lastmod>
  <priority>0.80</priority>
</url>
<url>
  <loc>https://mooxl.dev/privacy</loc>
  <lastmod>2022-10-01T22:00:05+00:00</lastmod>
  <priority>0.80</priority>
</url>

</urlset>
<?xml version="1.0" encoding="UTF-8"?>
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
<url>
  <loc>https://mooxl.dev/</loc>
  <lastmod>2022-10-01T22:00:05+00:00</lastmod>
  <priority>1.00</priority>
</url>
<url>
  <loc>https://mooxl.dev/imprint</loc>
  <lastmod>2022-10-01T22:00:05+00:00</lastmod>
  <priority>0.80</priority>
</url>
<url>
  <loc>https://mooxl.dev/privacy</loc>
  <lastmod>2022-10-01T22:00:05+00:00</lastmod>
  <priority>0.80</priority>
</url>

</urlset>
import { Translation } from "../utils/types.ts";

const Milestone = (props: { title: string; date: string; text?: string }) => (
  <div>
    <div class="flex justify-between md:flex-col">
      <h4 class="md:order-2">{props.title}</h4>
      <p class="md:order-1 md:mb-0.2">{props.date}</p>
    </div>
    {props.text && <p class="whitespace-pre-wrap">{props.text}</p>}
  </div>
);

const Education = (data: { translation: Translation["education"] }) => (
  <>
    <h3>{data.translation.title}</h3>
    <div class="space-y-3 lg:space-y-2">
      {data.translation.milestones.map((milestone) => (
        <Milestone {...milestone} />
      ))}
    </div>
  </>
);

export default Education;
import { Translation } from "../utils/types.ts";

const Milestone = (props: { title: string; date: string; text?: string }) => (
  <div>
    <div class="flex justify-between md:flex-col">
      <h4 class="md:order-2">{props.title}</h4>
      <p class="md:order-1 md:mb-0.2">{props.date}</p>
    </div>
    {props.text && <p class="whitespace-pre-wrap">{props.text}</p>}
  </div>
);

const Education = (data: { translation: Translation["education"] }) => (
  <>
    <h3>{data.translation.title}</h3>
    <div class="space-y-3 lg:space-y-2">
      {data.translation.milestones.map((milestone) => (
        <Milestone {...milestone} />
      ))}
    </div>
  </>
);

export default Education;

JSON

{
  "tasks": {
    "start": "deno run --allow-all --watch=static/,routes/ dev.ts ",
    "build": "deno run --allow-all dev.ts build",
    "preview": "deno run --allow-all main.ts"
  },
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact"
  },
  "imports": {
    "$fresh/": "https://deno.land/x/fresh@1.4.2/",
    "preact": "https://esm.sh/preact@10.15.1",
    "preact/": "https://esm.sh/preact@10.15.1/",
    "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.1",
    "@preact/signals": "https://esm.sh/*@preact/signals@1.1.3",
    "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.2.3",
    "twind": "https://esm.sh/twind@0.16.19",
    "twind/": "https://esm.sh/twind@0.16.19/",
    "smtp": "https://deno.land/x/smtp/mod.ts"
  },
  "lint": {
    "rules": {
      "tags": [
        "fresh",
        "recommended"
      ]
    },
    "exclude": [
      "_fresh"
    ]
  },
  "fmt": {
    "exclude": [
      "_fresh"
    ]
  }
}
{
  "tasks": {
    "start": "deno run --allow-all --watch=static/,routes/ dev.ts ",
    "build": "deno run --allow-all dev.ts build",
    "preview": "deno run --allow-all main.ts"
  },
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact"
  },
  "imports": {
    "$fresh/": "https://deno.land/x/fresh@1.4.2/",
    "preact": "https://esm.sh/preact@10.15.1",
    "preact/": "https://esm.sh/preact@10.15.1/",
    "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.1",
    "@preact/signals": "https://esm.sh/*@preact/signals@1.1.3",
    "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.2.3",
    "twind": "https://esm.sh/twind@0.16.19",
    "twind/": "https://esm.sh/twind@0.16.19/",
    "smtp": "https://deno.land/x/smtp/mod.ts"
  },
  "lint": {
    "rules": {
      "tags": [
        "fresh",
        "recommended"
      ]
    },
    "exclude": [
      "_fresh"
    ]
  },
  "fmt": {
    "exclude": [
      "_fresh"
    ]
  }
}

Python

from flask import Flask, render_template, request, redirect, url_for
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///users.db'  # Replace 'users.db' with your database name
db = SQLAlchemy(app)

# Create the User model
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), nullable=False)
    email = db.Column(db.String(120), unique=True, nullable=False)

    def __repr__(self):
        return f"<User {self.name}>"

# Create the database
db.create_all()

# Routes for CRUD operations
@app.route('/')
def index():
    users = User.query.all()
    return render_template('index.html', users=users)

@app.route('/add', methods=['POST'])
def add_user():
    name = request.form['name']
    email = request.form['email']

    new_user = User(name=name, email=email)
    db.session.add(new_user)
    db.session.commit()

    return redirect(url_for('index'))

@app.route('/update/<int:user_id>', methods=['POST'])
def update_user(user_id):
    user = User.query.get_or_404(user_id)
    user.name = request.form['name']
    user.email = request.form['email']

    db.session.commit()

    return redirect(url_for('index'))

@app.route('/delete/<int:user_id>', methods=['POST'])
def delete_user(user_id):
    user = User.query.get_or_404(user_id)
    db.session.delete(user)
    db.session.commit()

    return redirect(url_for('index'))

if __name__ == '__main__':
    app.run(debug=True)
from flask import Flask, render_template, request, redirect, url_for
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///users.db'  # Replace 'users.db' with your database name
db = SQLAlchemy(app)

# Create the User model
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), nullable=False)
    email = db.Column(db.String(120), unique=True, nullable=False)

    def __repr__(self):
        return f"<User {self.name}>"

# Create the database
db.create_all()

# Routes for CRUD operations
@app.route('/')
def index():
    users = User.query.all()
    return render_template('index.html', users=users)

@app.route('/add', methods=['POST'])
def add_user():
    name = request.form['name']
    email = request.form['email']

    new_user = User(name=name, email=email)
    db.session.add(new_user)
    db.session.commit()

    return redirect(url_for('index'))

@app.route('/update/<int:user_id>', methods=['POST'])
def update_user(user_id):
    user = User.query.get_or_404(user_id)
    user.name = request.form['name']
    user.email = request.form['email']

    db.session.commit()

    return redirect(url_for('index'))

@app.route('/delete/<int:user_id>', methods=['POST'])
def delete_user(user_id):
    user = User.query.get_or_404(user_id)
    db.session.delete(user)
    db.session.commit()

    return redirect(url_for('index'))

if __name__ == '__main__':
    app.run(debug=True)

Ruby

require "httparty"
require "ruby/openai/client"
require "ruby/openai/files"
require "ruby/openai/finetunes"
require "ruby/openai/images"
require "ruby/openai/models"
require "ruby/openai/version"

module Ruby
  module OpenAI
    class Error < StandardError; end
    class ConfigurationError < Error; end

    class Configuration
      attr_writer :access_token
      attr_accessor :api_version, :organization_id

      DEFAULT_API_VERSION = "v1".freeze

      def initialize
        @access_token = nil
        @api_version = DEFAULT_API_VERSION
        @organization_id = nil
      end

      def access_token
        return @access_token if @access_token

        error_text = "OpenAI access token missing! See https://github.com/alexrudall/ruby-openai#usage"
        raise ConfigurationError, error_text
      end
    end

    class << self
      attr_writer :configuration
    end

    def self.configuration
      @configuration ||= OpenAI::Configuration.new
    end

    def self.configure
      yield(configuration)
    end
  end
end
require "httparty"
require "ruby/openai/client"
require "ruby/openai/files"
require "ruby/openai/finetunes"
require "ruby/openai/images"
require "ruby/openai/models"
require "ruby/openai/version"

module Ruby
  module OpenAI
    class Error < StandardError; end
    class ConfigurationError < Error; end

    class Configuration
      attr_writer :access_token
      attr_accessor :api_version, :organization_id

      DEFAULT_API_VERSION = "v1".freeze

      def initialize
        @access_token = nil
        @api_version = DEFAULT_API_VERSION
        @organization_id = nil
      end

      def access_token
        return @access_token if @access_token

        error_text = "OpenAI access token missing! See https://github.com/alexrudall/ruby-openai#usage"
        raise ConfigurationError, error_text
      end
    end

    class << self
      attr_writer :configuration
    end

    def self.configuration
      @configuration ||= OpenAI::Configuration.new
    end

    def self.configure
      yield(configuration)
    end
  end
end

WebP

PNG

References

This has a footnotes[1].

Highlighting.

This is a quotation.


Sep 8, 2023 Sep 8, 2023 at 8:34 PM [[Organize, search, and customize in Bear]] - Link to other Notes. Apple Notes doesn’t allow.

Foo Bar
Baz Quality table. This app’s UI is a thing of beuaty, and its typography.

  1. Footnotes. Cool. Apple Notes doesn’t support. ↩︎