Skip to content

Instantly share code, notes, and snippets.

@alexanderytaylor
alexanderytaylor / pixel.js
Created March 27, 2024 21:16
shopify-posthog-custom-web-pixel
const postHogApiKey = "POSTHOG_API_KEY";
const postHogEndpoint = "https://app.posthog.com/capture";
const headers = {
"Content-Type": "application/json",
};
// Customer information
const customer = init.data.customer;
const { id, email, firstName, lastName } = customer;
const fullName = `${firstName} ${lastName}`;
@juliusmarminge
juliusmarminge / enum-generator.ts
Last active March 19, 2025 14:57
prisma enum generator
import { generatorHandler } from "@prisma/generator-helper";
import fs from "node:fs/promises";
import path from "node:path";
const header = `// This file was generated by a custom prisma generator, do not edit manually.\n`;
generatorHandler({
onManifest() {
return {
defaultOutput: "./enums/index.ts",
@steveruizok
steveruizok / .env.local
Last active March 14, 2023 19:20
Next.js SSR firebase auth
NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY=your_firebase_email
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_firebase_auth_domain
NEXT_PUBLIC_FIREBASE_DATABASE_URL=your_firebase_database_url
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_BASE_API_URL=http://localhost:3000
NEXT_PUBLIC_SERVICE_ACCOUNT=your_config_json_converted_to_base64
NEXT_PUBLIC_COOKIE_NAME=auth
@maxim
maxim / gh-dl-release
Last active May 13, 2025 00:14
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@fliptopbox
fliptopbox / string.compress.js
Created October 15, 2013 12:32
JavaScript String compression
/*
@fliptopbox
LZW Compression/Decompression for Strings
Implementation of LZW algorithms from:
http://rosettacode.org/wiki/LZW_compression#JavaScript
Usage:
var a = 'a very very long string to be squashed';
var b = a.compress(); // 'a veryāăąlong striċ to bečquashed'