Skip to content

Instantly share code, notes, and snippets.

View AWolf81's full-sized avatar

Alexander Wolf AWolf81

View GitHub Profile
@AWolf81
AWolf81 / slugify.sql
Created February 18, 2024 12:23
Slugify with md5 hash - SQL snippet
-- License MIT
-- Place in your schema & update your table name
-- First, make sure the pgcrypto & unaccent extension is available
CREATE EXTENSION IF NOT EXISTS unaccent with schema extensions;
CREATE EXTENSION IF NOT EXISTS pgcrypto with schema extensions;
CREATE OR REPLACE FUNCTION public.slugify("value" TEXT)
RETURNS TEXT AS $$
-- removes accents (diacritic signs) from a given string --
@AWolf81
AWolf81 / Mixpanel and Cookiebot Setup README.md
Last active March 6, 2024 13:21
Mixpanel & Cookiebot with Next.js

Usage

Installation

Install analytics and @analytics/mixpanel with

npm install analytics @analytics/mixpanel

Add tokens to your .env file

@AWolf81
AWolf81 / searchGoogle Readme.md
Last active December 20, 2022 20:55
Google spreadsheet app script - searchGoogle

Goal

Create a Google spreadsheet app script to enable Google search inside the table. I think that's not available in the app script store. If you like you can add it.

Column A contains the seachterm and column B will show the Google search result title, link & snippet.

Result will look like:

Search term Result
@AWolf81
AWolf81 / VS_code_webview_example.md
Last active September 26, 2022 21:26
VS Code Webview example (Provider with postMessage)
@AWolf81
AWolf81 / main.py
Created November 28, 2021 17:51
Kivy settings example with color picker option
"""
Config Example
==============
This file contains a simple example of how the use the Kivy settings classes in
a real app. It allows the user to change the caption, font_size of the label and
application background and stores these changes.
When the user next runs the programs, their changes are restored.
@AWolf81
AWolf81 / MD Kivy drawer example.md
Last active November 28, 2021 13:00
MD navigation drawer example (Kivy application)

Usage

To run this code follow https://kivy.org/doc/stable/gettingstarted/installation.html to have a project with Kivy installed.

Next, run pip install kivymd inside of your virtaul env.

Copy paste the code above into your project. KV files into subfolder kv and main.py into the root of your project.

Finally, run python main.py

@AWolf81
AWolf81 / devserver-plugin.js
Created February 7, 2021 13:41
Snippet for accessing dev server Javasript interface from Snowpack plugin
const snowpack = require("snowpack")
const {startServer} = snowpack;
let server;
/*
package.json snippet for starting "snowpack dev"
"scripts": {
"start": "cross-env NODE_ENV=development snowpack build --watch",
@AWolf81
AWolf81 / .env
Last active February 6, 2021 15:40
Demo for injecting the version from package.json with Snowpack
SNOWPACK_PUBLIC_SOME_OTHER_ENV=just a test
@AWolf81
AWolf81 / plugin-dotenv.js
Created February 4, 2021 22:21
Snowpack plugin-dotenv with path option
const fs = require('fs');
const path = require('path');
module.exports = function plugin(_, {path:envPath}) {
const NODE_ENV = process.env.NODE_ENV;
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
const dotenvFiles = [
NODE_ENV && `.env.${NODE_ENV}.local`,
// Don't include `.env.local` for `test` environment
@AWolf81
AWolf81 / content-script-2.ts
Created January 18, 2021 21:54
Web extension using snowpack & snowpack-plugin-web-ext for content-scripts
// location: src/content-scripts/content-script-2.ts
// just to have an import
export function hello() {
return "Hello World";
}