Skip to content

Instantly share code, notes, and snippets.

View Maxondria's full-sized avatar
🏠
Working from home

Maxon Tayebwa Maxondria

🏠
Working from home
View GitHub Profile
@Maxondria
Maxondria / tiptap-comment-extension.ts
Last active February 20, 2025 13:49
public-tiptap-comments
import { Mark, mergeAttributes, type Range } from '@tiptap/core';
import { Mark as PMMark } from '@tiptap/pm/model';
declare module '@tiptap/core' {
interface Commands<ReturnType> {
comment: {
addComment: (commentId: string) => ReturnType;
removeComment: (commentId: string) => ReturnType;
highlightComment: (commentId: string) => ReturnType;
unhighlightComment: (commentId: string) => ReturnType;
import { useRef, useState } from 'react';
export const useReactState = <T extends object>(initialState: T): T => {
const [, setState] = useState<number>(0);
const proxy = useRef(
new Proxy(initialState, {
set: (target, key, value) => {
if (!(key in target)) {
return false;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<style>
.required::before {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<style>
body {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<style>
.parent {
// keeping the same pattern
export default await new Promise(async $export => {
// export the module
$export({my: 'module'});
});
// dropping the Promise all together
export default await (async () => {
// await async dependencies
// export the module
@Maxondria
Maxondria / mac-setup-redis.md
Created September 7, 2021 13:09 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@Maxondria
Maxondria / READMESAMPLE.md
Created April 28, 2021 07:17
README.md Sample

FynixtechBackend API Documentation -v2.0.0

The purpose of this documentation is to detail principles, objects, behaviours and error handling for the AkaboxiBackend API.

This API has been developed to enable as a backend interface for all Akaboxi management systems / applications.

Important!

All endpoints must come after this URI: # /api/v2/admin. Forexample, https://server.com/api/v2/admin/ENDPOINT .All other requests hitting the endpoint directly will be rejected with a 404 (Not Found)

Installation

@Maxondria
Maxondria / es6-compose.md
Created October 2, 2020 09:26 — forked from JamieMason/es6-compose.md
ES6 JavaScript compose function

ES6 JavaScript Compose Function

Definition

const compose = (...fns) =>
  fns.reduceRight((prevFn, nextFn) =>
    (...args) => nextFn(prevFn(...args)),
    value => value
 );
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var domStyle = document.createElement("style");
domStyle.append(
'* { color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }\
* * { background-color: rgba(0,255,0,.2) !important; }\
* * * { background-color: rgba(0,0,255,.2) !important; }\
* * * * { background-color: rgba(255,0,255,.2) !important; }\
* * * * * { background-color: rgba(0,255,255,.2) !important; }\