Skip to content

Instantly share code, notes, and snippets.

@lega911
lega911 / App.xht
Last active October 28, 2020 21:43
Example: passing class v2
<script>
import Icon from './Icon.xht';
let name = 'world';
</script>
<Icon />
<Icon class="green bold" />
<br/>
<Icon class="aqua big" />
@lega911
lega911 / App.xht
Created October 28, 2020 21:35
Passing class v2
<script>
import Child from './Child.xht';
let forChild = 'glob bold hovered subtext';
let checked = false;
$runtime.addStyles('glob-css', `.glob {color:deeppink}`);
</script>
<div class="box">
@lega911
lega911 / App.xht
Created September 28, 2020 22:28
Attach a class 2
<script>
import Button from './Button.xht';
</script>
<Button .btn="red bold" name="Red bold" />
<Button .btn="purple" name="Purple" />
<Button name="Default" />
<style>
.red {color: red;}
@lega911
lega911 / App.xht
Created September 28, 2020 22:17
Attach a class
<script>
import Button from './Button.xht';
</script>
<h1>Pass class</h1>
<Button name="Red" class="btn" />
<Button name="Default" />
<style>
@lega911
lega911 / App.xht
Created September 28, 2020 19:02
Named $class
<script>
import Child from './Child.xht';
let cond = true;
</script>
<input type="checkbox" :checked={cond} />
<Child .header="red bold" .body:italic={cond} />
<style>
@lega911
lega911 / App.xht
Created September 28, 2020 18:51
Property $class
<script>
import Child from './Child.xht';
let cond = true;
</script>
<input type="checkbox" :checked={cond} />
<Child class="red italic" class:bold={cond} />
<style>
@lega911
lega911 / App.xht
Created September 25, 2020 18:47
Example how to pass CSS-class to child component
<script>
import Icon from './Icon.xht';
let name = 'world';
</script>
<Icon />
<Icon .icon="green bold" />
<br/>
<Icon .icon="aqua big" />
@lega911
lega911 / test.py
Created August 7, 2020 09:09
test connection to web.smscom.se
import requests
import time
def main():
ok = 0
fail = 0
for i in range(1000):
try:
r = requests.post('https://web.smscom.se/sendSms/sendSms.asmx')
print(i, r, r.content[:100] + b'...')
@lega911
lega911 / 1_repeat_fragment.html
Last active August 1, 2020 18:20
Example of fragments
<script>
const run = () => {};
const runLots = () => {};
const add = () => {};
const partialUpdate = () => {};
</script>
{#fragment:button id, name}
<div class="col-sm-6 smallpad">
<button type="button" class="btn" id={id} @click>{name}</button>
@lega911
lega911 / test.html
Created July 28, 2020 10:57
Chrome & FF hangs on HTML
<!DOCTYPE html>
<html lang="en">
<head>
<style>.x {display: grid;}</style>
</head>
<body>
<p><div class="x"><div></p></div>
<p><div class="x"><div></p></div>
<p><div class="x"><div></p></div>