Skip to content

Instantly share code, notes, and snippets.

View gbourant's full-sized avatar

gbourant gbourant

View GitHub Profile
@gbourant
gbourant / pre-commit-nocheckin
Created February 24, 2025 21:13 — forked from xezrunner/pre-commit-nocheckin
nocheckin pre-commit hook for Git
#!/bin/bash
# Author: xezrunner (github.com/xezrunner)
# Inspired by Jonathan Blow's nocheckin setup with SVN (twitch.tv/j_blow) (youtube.com/@jblow888)
# Credit: DustinGadal on r/Jai: reddit.com/r/Jai/comments/jp0vjy/nocheckin_behavior_in_gitsourcetree/gbfhzd1
# Required programs/utilities: git, grep, xargs, wc
# To install, move and rename to <repo>/.git/hooks/pre-commit (or merge)
# The file name has to be "pre-commit" for Git to use it. Compatible with Github Desktop GUI.
@gbourant
gbourant / pre-commit-nocheckin
Created February 24, 2025 21:13 — forked from xezrunner/pre-commit-nocheckin
nocheckin pre-commit hook for Git
#!/bin/bash
# Author: xezrunner (github.com/xezrunner)
# Inspired by Jonathan Blow's nocheckin setup with SVN (twitch.tv/j_blow) (youtube.com/@jblow888)
# Credit: DustinGadal on r/Jai: reddit.com/r/Jai/comments/jp0vjy/nocheckin_behavior_in_gitsourcetree/gbfhzd1
# Required programs/utilities: git, grep, xargs, wc
# To install, move and rename to <repo>/.git/hooks/pre-commit (or merge)
# The file name has to be "pre-commit" for Git to use it. Compatible with Github Desktop GUI.
@gbourant
gbourant / hx-clone.js
Created January 4, 2025 04:11 — forked from pauloevpr/hx-clone.js
Simple HTMX extension to allow cloning <template> elements in the DOM to avoid a round trip to the server.
htmx.config.useTemplateFragments = true
htmx.defineExtension('clone', {
onEvent: function (name, evt) {
if (name === 'htmx:beforeRequest') {
if (evt.detail.elt) {
const get = evt.detail.elt.getAttribute('hx-get')
if (get && get.startsWith('clone:')) {
const selector = get.substring(6)
//console.log('htmx-clone: Intercepting xhr request to inject template with selector:', selector)
const template = document.querySelector(selector)