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
@waptik
waptik / index.ts
Created July 12, 2021 16:48
A custom extension for tiptap v2 to for image upload
import { Node, nodeInputRule } from "@tiptap/core";
import { mergeAttributes } from "@tiptap/react";
import { uploadImagePlugin, UploadFn } from "./upload_image";
/**
* Tiptap Extension to upload images
* @see https://gist.github.com/slava-vishnyakov/16076dff1a77ddaca93c4bccd4ec4521#gistcomment-3744392
* @since 7th July 2021
*
@gmolveau
gmolveau / flask_separate_thread.py
Last active March 6, 2023 07:27
run a flask application in a separate thread
# please use python3 and flask > 1.0
# run this with : python3 flask_separate_thread.py
# https://web.archive.org/web/20210329135424/https://pymotw.com/3/threading/
# https://web.archive.org/web/20210329135553/https://eli.thegreenplace.net/2011/08/22/how-not-to-set-a-timeout-on-a-computation-in-python
import time
import threading
from flask import Flask
app = Flask(__name__)
@Defelo
Defelo / custom_html_head_content.html
Created January 31, 2021 21:33
KaTeX Support for Bookstack
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"></script>
<script>
function _katex_render(elem) {
renderMathInElement(
elem,
{
delimiters: [
@samwillis
samwillis / y-pouchdb.ts
Last active April 16, 2025 17:04
(Alpha) PouchDB integration for Yjs
import * as Y from 'yjs'
import * as mutex from 'lib0/mutex.js'
import { Observable } from 'lib0/observable.js'
import PouchDB from 'pouchdb';
// This is the name of the top level Y.Map that is used to construct the main pouchDB
// JSON document.
const topDataYMapName = 'data';
@jengel3
jengel3 / authentication-1.controller.ts
Last active April 23, 2024 19:26
NestJS - Implementing Access & Refresh Token Authentication
// app/modules/authentication/authentication.controller.ts
import { Body, Controller, Post } from '@nestjs/common'
import { RegisterRequest } from './requests'
import { User } from '../../modules/user'
import { UsersService } from '../users/users.service'
@gabrielfeitosa
gabrielfeitosa / config.env
Created September 25, 2020 18:55
Blue/Green deployment (Traefik, docker)
ENVIRONMENT=dev
OTHER_CONFIG=BLAH
@exiguus
exiguus / docker-swarm-wikijs-postgres.md
Created August 3, 2020 07:33
Docker Swarm with wiki.js and PgBouncer
@typewriter
typewriter / docker-compose.yml
Last active March 4, 2024 19:23
Zero downtime deployment reproduction using traefik
version: "3"
services:
traefik:
image: "traefik:v2.2"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
@brandonkramer
brandonkramer / dotenv.php
Last active January 31, 2022 11:37
PHP read .env file into an readable array to load system environment configuration $_ENV, $_SERVER, env, dotenv, getenv
<?php
try {
/**
* Throw exception if not found or is unreadable
*/
if ( !file_exists( __DIR__ . '/.env' ) || !is_readable( __DIR__ . '/.env' ) ) {
throw new Exception( 'The .env file is not found or unreadable.' );
}
/**
* Get the .env file, ignore new and empty lines.
@cagartner
cagartner / deploy.sh
Last active September 4, 2025 05:57
Laravel Push deploy Github actions example
#!/bin/sh
set -e
vendor/bin/phpunit
(git push) || true
git checkout production
git merge master