Skip to content

Instantly share code, notes, and snippets.

View maphe's full-sized avatar

Mathieu Pheulpin maphe

View GitHub Profile
@darul75
darul75 / middleware_gin_v2.go
Last active July 17, 2024 17:17
Clerk Go SDK : Gin Web Framework middleware
package clerk
import (
"errors"
"net"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
@arisrayelyan
arisrayelyan / VectorType.ts
Last active July 2, 2024 21:47
This gist contains a custom MikroORM type designed for working with pgVector embedding in PostgreSQL. With this custom type, you can seamlessly integrate pgVector embeddings into your MikroORM-based projects, enabling efficient handling of vector data within your PostgreSQL database.
import { Type, EntityProperty, ValidationError } from "@mikro-orm/core";
export class VectorType extends Type<
number[] | null,
string | null | undefined
> {
convertToDatabaseValue(value: number[] | string | undefined): string | null {
if (!value) {
return null;
}
@alex-ant
alex-ant / gzip.go
Created January 16, 2017 13:50
golang: gzip and gunzip
package main
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"log"
)
anonymous
anonymous / main.js
Created November 25, 2013 10:17
reload sf2 wdt on ajax request
$(document).ajaxComplete(function(event, XMLHttpRequest){
var token = XMLHttpRequest.getResponseHeader('x-debug-token'),
protocol = window.location.protocol,
hostname = window.location.hostname;
if(token) {
$.get(protocol+'//'+hostname+'/_wdt/'+token, function(data){
@glennblock
glennblock / fork forced sync
Created March 4, 2012 19:27
Force your forked repo to be the same as upstream.
git fetch upstream
git reset --hard upstream/master