Skip to content

Instantly share code, notes, and snippets.

View gahabeen's full-sized avatar

Gabin Desserprit gahabeen

View GitHub Profile
@PierBover
PierBover / index.js
Last active April 30, 2024 09:08
Micro router for Cloudflare Workers
const router = require('./router');
router.setRoutes([
{
path: '/ping',
method: 'GET',
handler: ping
},
{
path: '/hello/:name',
@slava-vishnyakov
slava-vishnyakov / readme.md
Last active May 7, 2024 04:49
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *
@anonyco
anonyco / Undo And Redo Mutation Observer Records.js
Last active August 10, 2021 20:00
This sample code snippet demonstrates how to undo and redo a MutationRecord observed by a MutationObserver
//(function(){"use strict";
var Object_freeze = Object.freeze;
/**
* @param {!Array<MutationRecord>} mutationRecords
* @return {undefined}
*/
function redoMutations(undidMutations) {
if (undidMutations) for (var i=undidMutations.length|0, record, type, target, addedNodes, removedNodes, nextSibling, value; i; ) {
@pocesar
pocesar / apify.d.ts
Last active February 4, 2022 07:36
apify typescript typings (non-official, but should help you get going)
declare module 'apify' {
import { IncomingMessage } from 'http'
import { EventEmitter } from 'events'
import {
Page,
Response as PuppeteerResponse,
ResourceType,
LaunchOptions,
HttpMethod,
Request as PuppeteerRequest,
@jonjack
jonjack / add-update-refresh-github-access-token-on-mac.md
Last active May 10, 2024 18:47
Adding & Updating GitHub Access Token on Mac

Using an Access Token for the first time

Follow the instructions on Github to Create an Access Token in Github

Configure Git to use the osxkeychain

By default, git credentials are not cached so you need to tell Git if you want to avoid having to provide them each time Github requires you to authenticate. On Mac, Git comes with an “osxkeychain” mode, which caches credentials in the secure keychain that’s attached to your system account.

You can tell Git you want to store credentials in the osxkeychain by running the following:-