Skip to content

Instantly share code, notes, and snippets.

View codebrainz's full-sized avatar

Matthew Brush codebrainz

View GitHub Profile
@codebrainz
codebrainz / add-extensions-gpt.ts
Last active May 19, 2023 20:10
Function generated by ChatGPT to add file extensions to TS imports (untested/unverified).
import * as fs from "fs";
import * as path from "path";
function updateImportsToUseFileExtension(directoryPath: string): void {
const files = fs.readdirSync(directoryPath);
files.forEach((file) => {
const filePath = path.join(directoryPath, file);
// Check if the file is a TypeScript file
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [
{
files: ['**/*.svelte'],
processor: 'svelte3/svelte3'
@codebrainz
codebrainz / arr-min.js
Created January 4, 2023 22:43
Find the smallest number in an array in JS
function min(arr) {
if (!arr) return NaN;
let min = Number.MAX_VALUE;
for (const element of arr) {
if (element < min) {
min = element;
}
}
return min;
@codebrainz
codebrainz / strrev-copy.js
Created January 4, 2023 21:30
Reversing a string in JS.
let str1 = "hello";
let str2 = "";
for (let i = str1.length - 1; i >= 0; i--) {
str2 += str1[i];
}
console.log(str1, "=>", str2);
diff --git a/src/client/pages/graphics.svelte b/src/client/pages/graphics.svelte
index 427638c..b2af00f 100644
--- a/src/client/pages/graphics.svelte
+++ b/src/client/pages/graphics.svelte
@@ -38,7 +38,7 @@
<!-- Per Bundle; this sets the name -->
<div class="font-bold wrapper-title bg-primary text-primary-content rounded-tl-lg border-neutral-focus border-1 p-1">
<span class="text-xl">{bundle.name}</span>
- <div class="tooltip tooltip-bottom z-20" data-tip="Reload all graphics in this bundle">
+ <div class="tooltip tooltip-bottom" data-tip="Reload all graphics in this bundle">
@codebrainz
codebrainz / cstr_hash.c
Created July 2, 2022 16:29
A decent C string hashing function
#include <stddef.h>
// sdbm from here:
// http://www.cse.yorku.ca/~oz/hash.html
static size_t cstr_hash(const char *str)
{
size_t hash = 0;
int c;
while ((c = *str++))
hash = c + (hash << 6) + (hash << 16) - hash;
@codebrainz
codebrainz / build
Created August 10, 2021 02:03
Test Meson build of Geany on Win10/Msys2
$ ninja -C build
ninja: Entering directory `build'
[34/261] Compiling C++ object libscintilla.a.p/scintilla_gtk_ScintillaGTK.cxx.o
../scintilla/gtk/ScintillaGTK.cxx: In function 'std::vector<int> MapImeIndicators(PangoAttrList*, const char*)':
../scintilla/gtk/ScintillaGTK.cxx:2301:13: warning: enumeration value 'PANGO_UNDERLINE_SINGLE_LINE' not handled in switch [-Wswitch]
2301 | switch (uline) {
| ^
../scintilla/gtk/ScintillaGTK.cxx:2301:13: warning: enumeration value 'PANGO_UNDERLINE_DOUBLE_LINE' not handled in switch [-Wswitch]
../scintilla/gtk/ScintillaGTK.cxx:2301:13: warning: enumeration value 'PANGO_UNDERLINE_ERROR_LINE' not handled in switch [-Wswitch]
[82/261] Compiling C object libfnmatch.a.p/ctags_fnmatch_fnmatch.c.o
@codebrainz
codebrainz / flags.hpp
Created February 26, 2020 02:21
For using C++ enum class values as bit flags.
#pragma once
#include <type_traits>
template <typename E>
struct enable_enum_flags {
static constexpr const bool value = false;
};
template <typename E>
@codebrainz
codebrainz / none.conf
Created October 26, 2019 00:16
A colourless Geany colour scheme.
[theme_info]
name=No Theme
description=A colour theme with no language highlighting.
version=0.01
author=
url=
[named_styles]
default=0x000000;0xffffff;false;false
diff --git a/meson.build b/meson.build
index ab1148cc..3d045976 100644
--- a/meson.build
+++ b/meson.build
@@ -32,11 +32,11 @@ def_cflags += '-DGEANY_DOCDIR="@0@"'.format(join_paths(prefix, get_option('datad
geany_cflags = def_cflags
have_gcc4_visibility = cc.has_argument('-fvisibility=hidden')
geany_cflags += '-DGEANY_PRIVATE'
-if target_machine.system() == 'windows'
- geany_cflags += '-DGEANY_EXPORT_SYMBOL="__declspec(dllexport)"'