Skip to content

Instantly share code, notes, and snippets.

View davemackintosh's full-sized avatar
❤️
peace

Dave Mackintosh davemackintosh

❤️
peace
View GitHub Profile
@davemackintosh
davemackintosh / option-a.kt
Last active January 25, 2024 13:58
Polling about ergonomics for Elp view and component state management and implementation. Files extensions are chosen for their syntax highlighting only.
import { App, Window } from "elp/app"
import { Form, Label, Input, Button } from "elp/app/elements"
import { Message, User } from "$types/chat"
import { Message as MessageView } from "$components/message"
export object ChatAppState implements Contextual {
.name: *string
.messages: []Message
.members: []User
.loggedIn: bool = false
@davemackintosh
davemackintosh / README.md
Last active September 26, 2023 08:57
I got fed up with the Svelte i18n library being huge and the latest being broken so wrote my own for https://sale-nook.com

Svelte i18n

I was a bit tired of the issues I was facing with the existing svelte i18n library, version problems, no intellisense for existing translations and the enormous bundled size so I created a very basic "get the job done" i18n library for Svelte.

Usage

Pop this in your +layout.svelte

@davemackintosh
davemackintosh / cdk-cloudformation-policy.json
Last active January 18, 2023 16:07
The minimum permissions required for `cdk bootstrap` to finish.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sts:AssumeRole"
],
"Resource": [
"arn:aws:iam::*:role/cdk-*"
@davemackintosh
davemackintosh / selene.toml
Last active January 1, 2023 21:33
An @xmake-io std library for Selene Lua linting. This only has what I've used in my config in it but over time I'm hoping it will be more useful than nothing that we all currently have
std = "xmake"
@davemackintosh
davemackintosh / note-generator.js
Created February 6, 2022 21:06
Generate octaves of musical notes in sequence with their corresponding midi note number and corresponding tab number.
const fs = require("fs/promises");
const main = async () => {
const out = [];
let outBuffer = Buffer.from("");
let tabValue = 0;
const notes = [
"A$",
"A#$/Bb$",
const config = {
"e02c2064-d961-4feb-lll4-558e0dd596d1": {
user: {
name: "Ian",
},
},
"f662b7aa-e2ff-4406-97c3-c0c6cb511159": {
user: {
name: "Greg",
},
import React from "react"
export const MyFormWithState = (props) => {
const [formState, setFormState] = useState({
name: "",
age: 0,
})
const onChange = (event) =>
setFormState({
function compose(...composable) {
return (component) =>
composable.reduceRight((children, Composable) => {
return <Composable>{children}</Composable>
}, component)
}
// compose(withRouter, withMyHOC, withYourHOC)(MyComponent)
export default compose
function renderLines(lines: number = 2): number {
const columns = process.stdout.columns
const resultingText = ("a").repeat((columns * lines))
const result = resultingText.length / columns // -- in testing this was like 1.99999467 so I ceil it
return Math.ceil(result) // -- lines
}
#!/bin/env bash
# EDIT THESE IF YOU WANT #####
# Locale
keyboard=us
encoding="UTF-8"
locale="en_GB"
# Time/Date
zone=Europe