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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Types for the result object with discriminated union | |
type Success<T> = { | |
data: T; | |
error: null; | |
}; | |
type Failure<E> = { | |
data: null; | |
error: E; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Outside of shell | |
# - Create project directory | |
# - git init | |
# - open in vs code >code . | |
# - Using remote container extensions create new development container | |
# - Using dotnet core 3.1 or later container template | |
# - Re-open in container and run the script below | |
dotnet new sln | |
dotnet new xunit -n Application.IntegrationTests -o ./tests/Application.IntegrationTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import json | |
import sys | |
import os | |
from Tkinter import Tk | |
URL="https://api.github.com/gists" | |
TOKEN="" |
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:
|
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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'}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { c, html } from "atomico"; // 3.0kB | |
function component({ name }) { | |
return html`<host shadowDom>Hello, ${name}</host>`; | |
} | |
component.props = { | |
name: String, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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 => |
NewerOlder