Skip to content

Instantly share code, notes, and snippets.

View RedHatter's full-sized avatar

Ava Johnson RedHatter

View GitHub Profile
@RedHatter
RedHatter / main.js
Created October 4, 2022 08:25
Scrap amazon order history and download invoices as PDFs
import puppeteer from "puppeteer";
function clickLink(page, selector) {
return Promise.all([page.click(selector), page.waitForNavigation()]);
}
const USERNAME = "jane.doe@gmail.com";
const PASSWORD = "************";
const PAGES = 2;
@RedHatter
RedHatter / ButtonGroup.svelte
Created February 11, 2021 05:29
Svelte form and input components with buildt-in validation
<script>
import { onMount, createEventDispatcher } from 'svelte'
import { getContext } from './Form.svelte'
const dispatch = createEventDispatcher()
export let value = ''
export let options = {}
let className
export { className as class }
@RedHatter
RedHatter / main.dart
Created December 22, 2020 02:18
Else if example
main () {
var a = 2;
var b = [
if (a == 1)
1
else if (a == 2)
2
];
print(b);
@RedHatter
RedHatter / format.js
Last active December 8, 2020 23:40
Prettier and postcss formatting
import fs from 'fs'
import transform from 'rollup-plugin-transform-input'
import prettier from 'prettier'
import postcss from 'postcss'
import sorting from 'postcss-sorting'
function formatContents(filepath, source) {
return prettier.format(source, {
filepath,
arrowParens: 'avoid',
@RedHatter
RedHatter / Route.svelte
Created December 4, 2020 01:16
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 = {
@RedHatter
RedHatter / DateMultiPicker.jsx
Last active August 4, 2021 02:14
Range and multi select for @dmtrKovalenko/material-ui-pickers
import React, { useState, useContext, useRef } from 'react'
import { DatePicker } from 'material-ui-pickers'
import { MuiPickersContext } from 'material-ui-pickers'
export default function DateMultiPicker({
value,
onChange,
labelFunc,
format,
emptyLabel,
@RedHatter
RedHatter / dead-simple-lightbox.js
Created January 30, 2019 22:43
A very simple zero dependency lightbox.
const css = document.createElement('style')
css.type = 'text/css'
css.innerHTML = `
.dead-simple-lightbox + * {
display: none;
}
.dead-simple-lightbox-container {
display: none;
position: fixed;
@RedHatter
RedHatter / build.sh
Created January 27, 2018 21:05
Gjs doesn't seem to execute Vala constructors. test.js should print 5 but instead it prints 0.
#!/bin/sh
valac gjs_constructor_test.vala -X -fPIC -X -shared -o gjs_constructor_test.so --library=GjsConstructorTest --gir GjsConstructorTest-0.1.gir
g-ir-compiler --shared-library=gjs_constructor_test.so --output=GjsConstructorTest-0.1.typelib GjsConstructorTest-0.1.gir
cp gjs_constructor_test.so /usr/lib/
cp GjsConstructorTest-0.1.typelib /usr/lib/girepository-1.0/
<template>
<div>test</div>
</template>
ERROR in ./public/scripts/display.js
Module not found: Error: Can't resolve 'test.js' in '/home/timothy/Projects/Tools/printmanager-2.0/public/scripts'
resolve 'test.js' in '/home/timothy/Projects/Tools/printmanager-2.0/public/scripts'
Parsed request is a module
using description file: /home/timothy/Projects/Tools/printmanager-2.0/package.json (relative path: ./public/scripts)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /home/timothy/Projects/Tools/printmanager-2.0/package.json (relative path: ./public/scripts)
resolve as module
/home/timothy/Projects/Tools/printmanager-2.0/public/scripts/node_modules doesn't exist or is not a directory
/home/timothy/Projects/Tools/printmanager-2.0/public/node_modules doesn't exist or is not a directory