Skip to content

Instantly share code, notes, and snippets.

Preact, Without Build Tools

This is a demonstration of using Preact without any build tooling. The library is linked from the esm.sh CDN, however a standalone JS file exporting HTM + Preact + Hooks can also be downloaded here.

import urllib2
import json
import sys
import os
from Tkinter import Tk
URL="https://api.github.com/gists"
TOKEN=""
@martinandersen3d
martinandersen3d / gist:2de4d79641f71fdd34c8e92963ecd3ff
Created August 24, 2023 00:32
Python Copy gif to clipboard on windows
# The steps are:
# 1. convert a gif to a base64 html image
# 2. copy HTML to clipboard
# 3. in MS Word, paste the html-gif
# Note: This does not work in Gmail, Google Docs and google products
import base64
import win32clipboard
@martinandersen3d
martinandersen3d / TkinterEditorWithLinenumbers.py
Created July 12, 2023 19:23
Python Tkinter Code Editor with Line numbers
import tkinter as tk
from tkinter import ttk
class GridApp:
def __init__(self):
self.root = tk.Tk()
self.root.title("Grid Layout")
# Create the Text_Linenumber widget

Goal: find a Linux alternative to FancyZones for Windows

Name Recommended Type Supports main colum Supports layouts Multiple windows in same tile Notes
gSnap 👍 Gnome extension yes yes yes Can be configured almost just like FancyZones; in the settings:
  • disable Show tabs
  • enable Hold CTRL to snap windows
gTile Gnome extension no?
Tiling Assistant 🤷 Gnome extension yes yes yes Layout support is "experimental" and the UX is a bit unintuitive; after enabling layouts, you have to click the star icon beside a layout to mark it as a favourite before you can then hold Alt while dragging to snap to a tile
[Forge](https://extensions.gnome.o
import {LitElement, html, css} from 'https://unpkg.com/lit-element/lit-element.js?module';
class MyElement extends LitElement {
static get properties() {
return {
title: {
type: String
},
location: {
type: String
//defining autonomous custom elements:
if(!customElements.get('my-element')){
customElements.define('my-element',MyElement);
}
//defining customised button element:
if(!customElements.get('custom-button')){
customElements.define('custom-button',CustomButton,{extends:'button'})
}
@martinandersen3d
martinandersen3d / hello.js
Created January 15, 2023 22:36 — forked from UpperCod/hello.js
atomico-example
import { c, html } from "atomico"; // 3.0kB
function component({ name }) {
return html`<host shadowDom>Hello, ${name}</host>`;
}
component.props = {
name: String,
};
@martinandersen3d
martinandersen3d / bootstrap-all-elements.html
Created January 9, 2023 20:46 — forked from letanure/bootstrap-all-elements.html
List of all bootstrap components
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap all elements</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
@martinandersen3d
martinandersen3d / DownloadAndShowImages.dib
Created November 21, 2022 22:48 — forked from AlRado/DownloadAndShowImages.dib
Downloads and displays images from the WEB
#!csharp
using System.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Interactive;
using Microsoft.DotNet.Interactive.Formatting;
using static Microsoft.DotNet.Interactive.Formatting.PocketViewTags;
void downloadAndShowImages(params string[] urls) {
display(span(urls.Select(url =>