This file contains hidden or 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 { h, FunctionalComponent, VNode, Build } from "@stencil/core"; | |
const Helmet: FunctionalComponent = (_prop, children: VNode[]) => { | |
if (Build.isBrowser) { | |
for (let child of children) { | |
const tagName = child.$tag$.toString(); | |
const attributes: { | |
[key: string]: string; | |
} = child.$attrs$; |
This file contains hidden or 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 { Component, Prop, h } from '@stencil/core'; | |
import Helmet from "/path/to/helmet.tsx"; | |
@Component({ | |
tag: 'my-first-component', | |
}) | |
export class MyComponent { | |
// Indicate that name should be a public property on the component | |
@Prop() name: string; |
This file contains hidden or 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 { h } from "@stencil/core"; | |
import { IUser } from "../interfaces/user.interface"; | |
export const UserAvatar = ({ user, size = 36 }: {user: IUser, size: number}) => { | |
const {name, luminosity, name} = user; | |
const [r, g, b] = themeColor | |
return ( | |
<svg | |
xmlns="http://www.w3.org/2000/svg" | |
viewBox="0 0 100 100" |
This file contains hidden or 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
Show hidden characters
{ | |
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | |
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | |
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | |
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | |
// Placeholders with the same ids are connected. | |
"Named import": { | |
"scope": "javascript,javascriptreact,typescript,typescriptreact", | |
"prefix": "from", |
This file contains hidden or 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 { useAtom } from 'jotai'; | |
import { useEffect, useLayoutEffect } from 'preact/hooks'; | |
import { themeAtom } from '__/stores/theme.store'; | |
type Theme = 'light' | 'dark'; | |
// This is needed here | |
let isFirstUpdate = true; | |
const localValue = localStorage.getItem<Theme>('theme:type'); |
This file contains hidden or 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
<script> | |
import { createIntervalStore } from './interval.store.ts' | |
// Create interval of 6 seconds | |
const interval = createIntervalStore(6000); | |
$: $interval, doSomething(); | |
</script> |
This file contains hidden or 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
var __create = Object.create; | |
var __defProp = Object.defineProperty; | |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | |
var __getOwnPropNames = Object.getOwnPropertyNames; | |
var __getProtoOf = Object.getPrototypeOf; | |
var __hasOwnProp = Object.prototype.hasOwnProperty; | |
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); | |
var __commonJS = (cb, mod) => function __require() { | |
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | |
}; |
This file contains hidden or 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
// @ts-check | |
import { dataToEsm } from '@rollup/pluginutils'; | |
import fs from 'fs'; | |
import lightningcss from 'lightningcss'; | |
import { resolve } from 'path'; | |
/** @type {() => import('rollup').Plugin} */ | |
export const processCSS = () => { | |
/** @type {Map<string, import('lightningcss').TransformResult>} */ | |
const idMap = new Map(); |
This file contains hidden or 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 { FormError } from '$lib/errors.js'; | |
import { db } from '$lib/server/db.js'; | |
import { GROUP_QUERY } from '$lib/server/queries/group.query.js'; | |
import { | |
expenses_table, | |
group_members_table, | |
ledger_table, | |
users_table, | |
} from '$lib/server/schema.js'; | |
import { listify_names, sum_arr } from '$lib/utils.js'; |
This file contains hidden or 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
class Ledger { | |
users = new Set<string>(); // Holds unique users | |
balances: Record<string, number> = {}; // Balance of each user | |
transactions: Record<`${string}:${string}`, number> = {}; // person1:person2 -> amount | |
simplified = false; | |
#results: Record< | |
'simplified' | 'non_simplified', | |
{ | |
payer_user_id: string; |
OlderNewer