- Install
typescript
,tslib
, andsvelte-check
for dev mode
pnpm i -D typescript tslib svelte-check
- Add a
tsconfig.json
-- insert a default snippet when file is first opened | |
local luasnip = require('luasnip') | |
local collection = require('luasnip.session.snippet_collection') | |
local util = require('luasnip.util.util') | |
local default_snippets = { | |
{ pattern = "/[+]page.svelte$", snippet = "page" }, | |
{ pattern = "/[+]page.js$", snippet = "page" }, | |
{ pattern = "/[+]page.ts$", snippet = "page" }, | |
{ pattern = "/[+]page.server.js$", snippet = "page.server" }, |
-- neovim snippets from scratch | |
local api = vim.api | |
local Snippets = { | |
list = { | |
lua = { | |
["if"] = "if $ then\nend", | |
p = "print($)", | |
func = "function $()\nend" | |
}, | |
javascript = { |
/* | |
* usage: | |
* | |
* // parse markdown | |
* const file = await parseMarkdown('posts/foo.md') | |
* | |
* // extract front matter | |
* const { title, summary, date, author, tags } = file.data.matter | |
* | |
* // access html |
<html> | |
<body> | |
<h1></h1> | |
<button onclick="decrement()">-</button> | |
<button onclick="increment()">+</button> | |
<script> | |
function signal(initial, callback = null) { | |
let value = initial |
from time import sleep_ms | |
from machine import SPI, Pin | |
from framebuf import FrameBuffer, MONO_HLSB | |
''' | |
Driver for Waveshare e-Paper 1.54in V2 | |
Note: This is for V2, check for V2 sticker on back of module. | |
Datasheet: https://files.waveshare.com/upload/e/e5/1.54inch_e-paper_V2_Datasheet.pdf |
User-agent: GPTBot | |
Disallow: / | |
User-agent: Google-Extended | |
Disallow: / | |
User-agent: Amazonbot | |
Disallow: / | |
User-agent: Applebot |
/* | |
* Usage: | |
* | |
* <element use:draggable/> | |
*/ | |
export function draggable(node) { | |
const bounds = node.getBoundingClientRect() | |
node.draggable = true | |
node.style.position = 'absolute' |
import fs from 'node:fs/promises' | |
export function sql(url) { | |
return { | |
name: 'vite-plugin-sql', | |
// expose an import called 'sql:runtime' | |
resolveId(id) { | |
if (id.startsWith('sql:runtime')) { | |
return id |
import { expect } from 'vitest' | |
expect.extend({ | |
async toError(promise, status, message=null) { | |
try { | |
await promise | |
return { pass: false, message: () => 'Expected an error to be raised.'} | |
} catch (actual) { | |
if (actual?.constructor?.name !== 'HttpError') { |