Skip to content

Instantly share code, notes, and snippets.

View Philipinho's full-sized avatar
🎯
Focusing on Java

Philip Okugbe Philipinho

🎯
Focusing on Java
View GitHub Profile
@Venryx
Venryx / Fractional Indexing (David Greenspan).md
Last active May 16, 2025 10:02
List of various fractional-indexing schemes, along with language-specific implementations
@ssddanbrown
ssddanbrown / bookstack-backup.sh
Last active May 18, 2025 17:40
bookstack-backup
#!/bin/bash
# Directory to store backups within
# Should not end with a slash and not be stored within
# the BookStack directory
BACKUP_ROOT_DIR="$HOME"
# Directory of the BookStack install
# Should not end with a slash.
BOOKSTACK_DIR="/var/www/bookstack"
@gregveres
gregveres / line-height.ts
Created May 4, 2022 12:20
line-heights for tiptap 2
import { Extension } from "@tiptap/core";
export interface LineHeightOptions {
types: string[];
heights: string[];
defaultHeight: string;
}
declare module "@tiptap/core" {
interface Commands<ReturnType> {
@gregveres
gregveres / back-color.ts
Created May 3, 2022 23:26
background-color for tiptap 2
import { Extension } from "@tiptap/core";
import "@tiptap/extension-text-style";
export type ColorOptions = {
types: string[];
};
declare module "@tiptap/core" {
interface Commands<ReturnType> {
backColor: {
@anchan828
anchan828 / README.md
Last active April 1, 2025 14:23
This is an improvement to allow @nestjs/[email protected] to handle CustomRepository. I won't explain it specifically, but it will help in some way. https://github.com/nestjs/typeorm/pull/1233

You need to provide some classes and decorators yourself to maintain the same style as [email protected].

1. EntityRepository -> CustomRepository

@EntityRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}

@cobola
cobola / cloudflare.js
Created February 9, 2022 04:14
batch remove cloudflare dns records
let axios = require('axios')
let zone = 'test.com'
let head = {
'X-Auth-Email': '[email protected]',
'X-Auth-Key': 'test123',
'Content-Type': 'application/json',
}
async function getZoneID() {
@carmel
carmel / marked-katex.js
Created January 8, 2022 15:35
marked with katex
import { marked } from 'marked'
import hljs from 'highlight.js'
import katex from 'katex'
marked.setOptions({
langPrefix: 'hljs lang-',
pedantic: false,
gfm: true, // 是否启动类似Github样式的Markdown
breaks: false, // 是否支持Github换行符
tables: true, // 是否支持Github形式的表格
@kiliman
kiliman / globals.js
Created January 5, 2022 19:42
remix-fastify adapter
'use strict';
var node = require('@remix-run/node');
node.installGlobals();
@robertdrakedennis
robertdrakedennis / editor.blade.php
Created December 16, 2021 05:14
Alpine tiptap editor + livewire
<div x-data="setupEditor(@entangle($attributes->wire('model')).defer)" x-init="() => init($refs.editor)" wire:ignore
{{ $attributes->whereDoesntStartWith('wire:model')->merge(['class' => 'editor !w-full !max-w-full']) }}>
<template x-if="editor">
<div class="flex space-x-4 items-center dark:text-neutral-100 fill-current py-2">
<button @click.prevent="Alpine.raw(editor).chain().toggleBold().focus().run()">
<x-icon-bold class="w-4 h-4" />
</button>
<button @click.prevent="Alpine.raw(editor).chain().toggleItalic().focus().run()">
<x-icon-italic class="w-4 h-4" />
</button>
@kjmph
kjmph / A_UUID_v7_for_Postgres.sql
Last active July 11, 2025 21:24
Postgres PL/pgSQL function for UUID v7 and a bonus custom UUID v8 to support microsecond precision as well. Read more here: https://datatracker.ietf.org/doc/rfc9562/
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
create or replace function uuid_generate_v7()
returns uuid
as $$
begin
-- use random v4 uuid as starting point (which has the same variant we need)
-- then overlay timestamp
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string
return encode(