Skip to content

Instantly share code, notes, and snippets.

@tomatrow
tomatrow / rcWidget.js
Created February 4, 2022 19:24 — forked from milesw/rcWidget.js
rcWidget.js
import 'core-js/es6/array';
import 'core-js/es6/object';
import 'core-js/es6/string';
// Global options
import defaults from './_config';
// general helper functions
import Helper from './_helpers';
// general pricing and currency functions
import Pricing from './_pricing';
// throttle and debounce manager
@tomatrow
tomatrow / request.ts
Created October 8, 2021 04:57
Svelte Kit Request
import type { RequestHandler } from "@sveltejs/kit"
import { browser } from "$app/env"
export type Method = "get" | "put" | "post" | "patch" | "delete"
export type UnpackHandler<Handler> = Handler extends (RequestHandler<infer Locals, infer Input, infer Output>) ? { locals: Locals, input: Input, output: Output }: unknown
export interface RequestConfig {
method?: Method
body?: any
@tomatrow
tomatrow / RewriteLoader.svelte
Last active June 11, 2021 22:24
Kind of does does rewrites for SvelteKit
<script context="module" lang="ts">
import type { Load, LoadInput, LoadOutput } from "@sveltejs/kit"
export interface Route {
id: any
load: Load
}
export function rewriteLoad(routes: Route[]): Load {
return async input => {
@tomatrow
tomatrow / Route.svelte
Last active December 4, 2020 08:47 — forked from RedHatter/Route.svelte
Single file router for svelte.
<script>
import UrlPattern from 'url-pattern'
import location, { navigate, noMatch } from './location.js'
export let path
export let component = undefined
export let redirect = undefined
$: pattern = new UrlPattern(path)
$: router = {
@tomatrow
tomatrow / braket-border.scss
Created February 15, 2020 23:52
Braket Border SCSS Style
// for the headings in sidebars
$braket-border-opposites: (
left: right,
right: left,
top: bottom,
bottom: top
);
@mixin braket-border-child($direction, $border-width, $length) {
content: "";
@tomatrow
tomatrow / index.html
Created February 15, 2020 03:58
Sharp Shadowed Button
<div class="button">Title</div>
@tomatrow
tomatrow / .gitignore
Last active June 8, 2018 03:24
Convert CalCoast statements to something ledger can use.
statements
name date gender period grams ethnicity
0 1 50 25 10 15
conrad 2 girl pm 3175.15 greek
nic 2 girl am 3373.59 nic
alisha 2 girl pm 3685.44 white
brad 3 boy am 4592.62 greek
aj 4 girl am 2409.71 asian
@tomatrow
tomatrow / dict.fish
Last active October 28, 2017 22:32 — forked from RomanHargrave/assoc.fish
# ASCII Unit separator, purpose is to separate subrecords, etc...
set __dict_US \31
# Groks name[key] and sets varname and key variables
function dict._parsename -S -a raw
set -l data (string match -r '(.+)\[(.+)\]' $raw)
if [ (count $data) -lt 3 ]
echo "Invalid dictionary syntax '$raw'"
return 1
else
@tomatrow
tomatrow / codestream.fish
Last active March 29, 2020 17:45
Twitch streaming customized for coding (mostly reading documentation)."
# AJ Caldwell - tomatrow@gmail.com
function codestream -d "Twitch streaming customized for coding (mostly reading documentation)."
# Input configuration.
set IN_VIDEO_ID "1" # The main screen we code from.
set IN_AUDIO_ID "0" # The Twitch-Input we set previously.
set SOURCE "$IN_VIDEO_ID:$IN_AUDIO_ID" # avfoundation assigns numbers to video/audio devices.
set INRES "1440x900" # input resolution for a macbook air
set IN_FPS "10" # Our rate of video capture.