Current
html.div([], [
html.button([event.on_click(Increment)], [
element.text("+")
]),
element.text(count),
html.button([event.on_click(Decrement)], [
element.text("-")
]),
type Modifiers = { | |
ctrl?: boolean; | |
shift?: boolean; | |
}; | |
type HotkeyDetails = { key: string } & Modifiers; | |
const hotkeyName = ({ key, ctrl, shift }: HotkeyDetails) => | |
`hotkey:${ctrl || ""}+${shift || ""}+${key}`; |
Current
html.div([], [
html.button([event.on_click(Increment)], [
element.text("+")
]),
element.text(count),
html.button([event.on_click(Decrement)], [
element.text("-")
]),
import { truncateMiddle } from '.'; | |
describe('utils', () => { | |
// ...pretty exaustive for a string utility, I know... | |
describe('truncateMiddle', () => { | |
const testStrings = [ | |
'0x3172635bc846d0c68afce1738d048520dcfafed2d55d1866a5ed5a40d5ea66c7', // 66 chars | |
'0000000000000000000000000000000000000000000000', // 46 chars | |
'00000000000000000000000000000000000000000000000', // 47 chars | |
]; |
const $ = document.querySelector.bind(document), | |
$$ = document.querySelectorAll.bind(document), | |
h = (name, props) => Object.assign(document.createElement(name), props); | |
const context = [] | |
const getCurrentObserver = () => context[context.length - 1] | |
function createEffect(fn, name) { | |
const execute = () => { | |
context.push(execute) |
const context: Function[] = [] | |
function getCurrentObserver() { | |
return context[context.length - 1] | |
} | |
function createEffect(fn: Function, name: string) { | |
const execute = () => { | |
context.push(execute) | |
try { |
export class QueryBuilder { | |
private collection: CollectionReference<DocumentData, DocumentData> | |
constructor(path: string) { | |
this.collection = collection(firestore, path) | |
} | |
private where: QueryFieldFilterConstraint[] = [] | |
filter(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown) { | |
this.where.push(where(fieldPath, opStr, value)) | |
return this |
// Inspired by https://github.com/codediodeio/sveltefire & previous stuff I did here https://gist.github.com/metruzanca/e516aac42c79d16c894883e88d8af5f8 | |
import { CollectionReference, DocumentData, Firestore, Query, QueryDocumentSnapshot, QuerySnapshot, collection, onSnapshot } from "firebase/firestore"; | |
import { Accessor, from } from "solid-js"; | |
type CollectionSignal<T> = { | |
signal: Accessor<T[]> | |
ref: CollectionReference<T> | Query<T> | null | |
} |
// ==UserScript== | |
// @name Jira Column Points | |
// @namespace metruzanca | |
// @version 0.1.0 | |
// @description Adds utilities to jira boards | |
// @author metruzanca | |
// @match https://*.atlassian.net/jira/software/c/projects/*/boards/* | |
// ==/UserScript== | |
function addStyle(cssString, container = document.head) { |
export type Success<Data> = readonly [Data, undefined]; | |
export type Failure<Err = Error> = readonly [undefined, Err]; | |
/** A cross between Rust and Golang exception handling. I greatly dislike exceptions */ | |
export type Result<Data, Err = Error> = Promise<(Success<Data> | Failure<Err>)> | |
export const Ok = <T>(data: T): Success<T> => [data, undefined] | |
export const Err = <E = Error>(error: E): Failure<E> => [undefined, error] |