Skip to content

Instantly share code, notes, and snippets.

View AmitMirgal's full-sized avatar
🧑‍💻
Software Engineer

amitmirgal AmitMirgal

🧑‍💻
Software Engineer
View GitHub Profile
{
"openapi": "3.0.3",
"info": {
"title": "squzy API",
"description": "squzy is the modern link attribution platform for short links, conversion tracking, and affiliate programs.",
"version": "0.0.1",
"contact": {
"name": "squzy Support",
"email": "amit@tapasom.com",
"url": "https://squzy.link/api"
@AmitMirgal
AmitMirgal / carbon.c
Created August 7, 2024 23:41
Carbon hook sends a percentage of outgoing payments to a dedicated account.
#define HAS_CALLBACK
#include <stdint.h>
#include "hookapi.h"
int64_t cbak(uint32_t reserved)
{
TRACESTR("Carbon: callback called.");
return 0;
}

Carbon

Carbon hook sends a percentage of outgoing payments to a dedicated account.

The beneficiary account is hard-coded, so while the default version of carbon.c works, it works with an account that cannot be imported into Hooks Builder (unless you know its secret key). See later examples for how to parametrize a hook.

to test:

  • make sure Hooks Builder has at least 3 accounts: Alice, Bob and Carol
  • in carbon.c, change hardcoded beneficiary to Carol account
  • compile carbon.c and deploy it to Alice account
@AmitMirgal
AmitMirgal / addresslookup.tsx
Created April 14, 2024 19:10
React component that uses forward geocoding from the Mapbox service. You can copy and paste this into your app code, styled with TailwindCSS
/*
This example requires some changes to your config:
```
import tailwindCSSForms from "@tailwindcss/forms";
// tailwind.config.js
export default {
// ...
plugins: [
@AmitMirgal
AmitMirgal / route.tsx
Created December 17, 2023 02:00
google places and geocoding
import { Loader } from "@googlemaps/js-api-loader";
export default function Example() {
const loader = new Loader({
apiKey: "<google-API-key>",
version: "weekly",
libraries: ["places", "geocoding"],
});
useEffect(() => {
@AmitMirgal
AmitMirgal / api.chimoney.webhook.tsx
Created December 13, 2023 01:51
Chimoney webhook api using the Remix framework with Svix webhook function and resend for transactional email.
import { json } from "@remix-run/node";
import type { ActionFunctionArgs } from "@remix-run/node";
import { Resend } from "resend";
import isEmpty from "lodash/isEmpty";
import { Webhook } from "svix";
export async function loader() {
return json({ result: "api-chimoney-webhook" });
}