Skip to content

Instantly share code, notes, and snippets.

View markflorkowski's full-sized avatar
™️

Mark R. Florkowski markflorkowski

™️
View GitHub Profile
@markflorkowski
markflorkowski / handler.js
Last active July 26, 2024 10:45
Clerk New Users - Discord Transform
function handler(webhook) {
const {data: user} = webhook.payload;
// Extract relevant details
const emailAddress = user.email_addresses?.[0]?.email_address || 'Unknown user';
const firstName = user.first_name || '';
const lastName = user.last_name || '';
const fullName = `${firstName} ${lastName}`.trim() || emailAddress;
const profileImageUrl = user.profile_image_url || 'https://www.gravatar.com/avatar?d=mp';
const createdAt = new Date(user.created_at).toLocaleString();
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument */
interface Logger {
trace(message: string, ...optionalParams: any[]): void;
debug(message: string, ...optionalParams: any[]): void;
info(message: string, ...optionalParams: any[]): void;
warn(message: string, ...optionalParams: any[]): void;
error(message: string, ...optionalParams: any[]): void;
[x: string]: any;
}
@markflorkowski
markflorkowski / replaceShortSha.js
Created April 26, 2023 20:52
Github "Copy Full SHA" UserScripts
// or just replace the short sha with the full length one
(function() {
const links = document.querySelectorAll("a.Link--muted svg.octicon-git-commit");
links.forEach(link => {
link.parentElement.innerText = link.parentElement.href.split("/").pop()
});
})();
@markflorkowski
markflorkowski / spec.yaml
Last active December 14, 2021 23:29
Testing OpenAPI spec
---
swagger: "2.0"
info:
version: "1.0.0"
title: "Minimal OpenAPI Spec"
description: "A sample API for testing"
termsOfService: "http://swagger.io/terms/"
contact:
name: "N/A"
license:
{"swagger":"2.0","info":{"description":"Redis Labs Pro API ","version":"Version 1","title":"Redis Labs Cloud API - Version 1","contact":{"name":"Customer Support","url":"https://support.redislabs.com","email":"support@redislabs.com"},"license":{}},"host":"api.redislabs.com","basePath":"/v1","tags":[{"name":"Account","description":"Current account and ownership information"},{"name":"Subscriptions","description":"All operations related to subscriptions lifecycle"},{"name":"Databases","description":"All operations related to databases lifecycle"},{"name":"Cloud Accounts","description":"All operations related to cloud accounts (RV only)"},{"name":"Tasks","description":"Displays information on long running operations"}],"produces":["application/json"],"paths":{"/":{"get":{"tags":["Account"],"summary":"Get current Account","description":"Current account and related information","operationId":"getCurrentAccountUsingGET","produces":["application/json"],"responses":{"200":{"description":"OK","schema":{"$ref":"#/defin
@markflorkowski
markflorkowski / labeler.gs
Last active November 26, 2020 20:05
Gmail - Label emails based on sender domain
function main() {
const labelMap = new Map();
Gmail.Users.Labels.list("me").labels.forEach((label) => {
if (label.type == "user") labelMap[label.name] = label.id;
});
if (messageList = Gmail.Users.Messages.list("me", {
q: "in:Inbox has:nouserlabels",
}).messages) {
messageList.forEach((msg) => {
const newLabel =