Skip to content

Instantly share code, notes, and snippets.

View VPKSoft's full-sized avatar
😄
Doing the hobby with a smile as always..

Petteri Kautonen VPKSoft

😄
Doing the hobby with a smile as always..
View GitHub Profile
@VPKSoft
VPKSoft / QuillCss.ts
Created November 26, 2023 11:26
Font family div for Quill with styled components.
import * as React from "react";
import { styled } from "styled-components";
const QuillFontCssDiv = styled.div<{ $fontFamilies: string[] }>`
${props =>
props.$fontFamilies
.map(f => {
const nameHyphenated = f.replaceAll(" ", "-").toLowerCase();
const name = f;
return `
@VPKSoft
VPKSoft / UsePasteImageMarkdown.ts
Created November 5, 2023 09:48
A custom React hook to paste image as markdown syntax to textarea
/*
MIT License
Copyright (c) 2023 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@VPKSoft
VPKSoft / UseDocumentReady.ts
Last active November 5, 2023 10:12
React hook for document ready callback
/*
MIT License
Copyright (c) 2023 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@VPKSoft
VPKSoft / SendKeys.cs
Created October 19, 2019 12:05
A helper class for the SendKeys.Send method, see [documentation](docs.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys.send).
#region license
/*
This file is public domain.
You may freely do anything with it.
Copyright (c) VPKSoft 2019
*/
#endregion
using System.Collections.Generic;
using System.Windows.Forms;
@VPKSoft
VPKSoft / MessageHelper.cs
Last active October 4, 2021 02:05
A helper class form messages with Windows Forms WndProc override.
#region License
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
@VPKSoft
VPKSoft / ScriptRunner.cs
Last active October 4, 2021 02:06
An utility class for running scripts against a SQLite database for database update / change. Useful in a software using a SQLite database for something.
#region license
/*
This file is public domain.
You may freely do anything with it.
Copyright (c) VPKSoft 2019
*/
#endregion
using System;
@VPKSoft
VPKSoft / IpcClientServer.cs
Created January 5, 2019 12:12
A class for IPC channel messaging.
#region license
/*
This file is public domain.
You may freely do anything with it.
Copyright (c) VPKSoft 2019
*/
#endregion
using System;