Skip to content

Instantly share code, notes, and snippets.

@artydev
artydev / py_webview_webio_flask_sample.py
Created May 3, 2024 23:04 — forked from mkeneqa/py_webview_webio_flask_sample.py
sample starter code for using pywebio in pywebview with flask server on Windows
import webview
import pywebio
from pywebio.platform.flask import webio_view
from flask import Flask, escape, request, send_from_directory, current_app, url_for
from pywebio import STATIC_PATH
from pywebio.input import *
from pywebio.output import *
from pywebio.session import *
import logging
from datetime import date, timedelta
@reosablo
reosablo / buildless-angular-17-app-with-babel.html
Last active December 14, 2024 05:19
Buildless Angular 17 app with `@babel/standalone`
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Buildless Angular 17 app with @babel/standalone</title>
<script type="importmap">
{
"imports": {
"@angular/common": "https://esm.sh/v135/@angular/[email protected]?dev",
@alexis-martel
alexis-martel / main.js
Last active April 30, 2024 08:55
How to use the native Compression Streams API to compress and decompress strings in JavaScript
async function compressAndEncode(inputString) {
const encoder = new TextEncoder();
// Create a ReadableStream from the input string
const inputReadableStream = new ReadableStream({
start(controller) {
controller.enqueue(encoder.encode(inputString));
controller.close();
}
});
@Larkenx
Larkenx / EventHandler.js
Last active September 10, 2020 09:06
JavaScript Goal Driven AI with Event Streams, based on socket.io's API & Caves of Qud goal driven AI https://youtu.be/4uxN5GqXcaA
export default class EventHandler {
constructor(eventStream) {
this.eventStream = eventStream
}
on(topic, fn) {
this.eventStream.addEventListener(topic, fn)
return this
}
}