Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Tooting on Mastodon
// @namespace Violentmonkey Scripts
// @match https://mastodon.nz/*
// @grant none
// @version 1.0
// @author Keith Nicholas
// @description 10/11/2022, 3:42:31 pm
// ==/UserScript==
@keithn
keithn / index.html
Created May 13, 2022 12:40
default
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
using System;
using System.Collections.Immutable;
namespace ConsoleDU
{
record CartItem(string Value);
record Payment(decimal Amount);
abstract record Cart
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
return new Item()
{
Name = addName,
Weight = int32.Parse(addWeight),
Value = int32.Parse(addValue)
};
return new Item()
{
Name = addName,
Weight = int32.Parse(addWeight),
Value = int32.Parse(addValue)
};
@keithn
keithn / vue ish
Last active December 21, 2020 04:30
vueish
<template>
<header>
<div class="Logo">
<img src="../assets/logo.svg">
</div>
<div class="NavBar-Desktop">
<div class=""></div>
<div class=""></div>
</div>
<div class="HamburgerMenu" @click="showMenu = !showMenu">
@keithn
keithn / grids.cs
Last active November 3, 2020 10:49
Grids.....
using System;
namespace Grids
{
class Program
{
static void Main(string[] args)
{
var grid = new GameGrid(5, 7);
grid.Display();
function myReplace(str, before, after) {
let isCapitalized = w => w[0].toUpperCase() === w[0]
let capitalize = w => w[0].toUpperCase() + w.slice(1)
let lower = w => w[0].toLowerCase() + w.slice(1)
let r = []
for(let w of str.split(" ")){
if(w.toLowerCase() === before.toLowerCase()) {
r.push(isCapitalized(w)?capitalize(after):lower(after))
} else r.push(w)
}
function titleCase(str) {
let titled = []
let upper = true;
for(let letter of str.toLowerCase()) {
titled.push( upper ? letter.toUpperCase() : letter )
upper = (letter === ' ')
}
return titled.join('')
}