Skip to content

Instantly share code, notes, and snippets.

View gaving's full-sized avatar
🎯
Focusing

Gavin Gilmour gaving

🎯
Focusing
View GitHub Profile
@gaving
gaving / pluralize.js
Created February 6, 2024 08:31
pluralize
function pluralize(count, word) {
// Basic pluralization rules
const pluralRules = [
{ match: /(?:ch|sh|ss|x|z)$/, replace: "$&es" }, // Matches words ending in ch, sh, ss, x, z
{ match: /([^aeiou])y$/, replace: "$1ies" }, // Changes words ending in y preceded by a consonant to ies
{ match: /([^aeiou])o$/, replace: "$1oes" }, // Changes words ending in o preceded by a consonant to oes (e.g., hero to heroes)
{ match: /is$/, replace: "es" }, // Special case for words ending in is
{ match: /([^aeiou]o)$/, replace: "$1es" }, // Special case for words ending in o preceded by a consonant
// Add more rules as needed
];
@gaving
gaving / install.log
Last active January 12, 2023 16:35
win32yank latest build
Compiling proc-macro2 v1.0.49
Compiling quote v1.0.23
Compiling unicode-ident v1.0.6
Compiling syn v1.0.107
Compiling winapi-x86_64-pc-windows-gnu v0.4.0
Compiling libc v0.2.139
Compiling serde_derive v1.0.152
<jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
<jemalloc>: (This is the expected behaviour if you are running under QEMU)
<jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
[
{
"operation": "shift",
"spec": {
"cluster_id": "cluster_id",
"source": "source",
"relationship_details": {
"parents": {
"*": {
"id": "parents"
@gaving
gaving / example.cql
Last active December 13, 2022 14:40
// Delete all nominals
MATCH (n:Nominal) DETACH DELETE n;
// Delete all incidents
MATCH (i:Incident) DETACH DELETE i;
// Convert data from JSON
WITH apoc.convert.fromJsonMap('{
"cluster_id": 5,
"source": "vpd",
mdl . | ( grep -v "Kramdown Warning: No link definition for link ID '\[\?_toc_\]\?' found on line" || true )
@gaving
gaving / README.md
Last active January 19, 2021 19:53
import-icons-by-path

Description

Convert Material UI icons to path imports. E.g.

-import { ErrorOutline as ErrorIcon } from "@material-ui/icons";
+import ErrorIcon from "@material-ui/icons/ErrorOutline";

Reasoning:-

@gaving
gaving / README.md
Last active January 19, 2021 19:38
convert-to-absolute-imports

Description

Convert Material UI icons to path imports. E.g.

-import DashboardTitle from "../../../components/Dashboard/DashboardTitle";
+import DashboardTitle from "components/Dashboard/DashboardTitle";

Reasoning:-

@gaving
gaving / index.html
Created January 2, 2021 09:24
Type The TOS
<div class="tos-wrapper">
<h1 class="title">TOS</h1>
<div id="count"></div>
<div id="tos"></div>
</div>

Keybase proof

I hereby claim:

  • I am gaving on github.
  • I am gaving (https://keybase.io/gaving) on keybase.
  • I have a public key ASAus1flHDIEFaLySFtJhm8D-LbShQcRlNkmqf87GlgKHQo

To claim this, I am signing this object:

@gaving
gaving / merge_flow.sh
Last active February 23, 2020 21:11
merge_flow.sh
#merge <commit/merge message>
#to be run in a dirty working tree on a feature branch
merge() {
g # status
# gcb $1
gca --signoff -m $1 # commit
gpsup # push branch and track remote
MR=$(lab mr create -d -a gaving -m $1 | tr -d -c 0-9) # create merge and store number
lab mr list # list
lab mr show $MR # show