Skip to content

Instantly share code, notes, and snippets.

View daguitosama's full-sized avatar

Dago daguitosama

  • some where in the tropical line
  • 16:54 (UTC -05:00)
View GitHub Profile

Stylus chrome ext styles to enable Dark Mode for postgresql.org

body {
    background-color: #23262e !important;
    color: #aeb8c7 !important;
}

nav.bg-light{
    background-color: #23262e !important;
}
@daguitosama
daguitosama / raycast-pronunciation-command.bash
Created November 28, 2022 02:20
A custom script command to pronounce expressions from the Raycast panel. It uses the macOS `say` command under the hood.
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Sam tell me
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🗣
# @raycast.argument1 { "type": "text", "placeholder": "Expression" }
@daguitosama
daguitosama / wix_member_api.ts
Last active July 19, 2023 17:25
Dago Wix SDK Client Implementation for use only on a server environment with Remix
export function create_wix_member_api({ client_id, env }: { client_id: string; env: Env }) {
var oauth = OAuthStrategy({
clientId: client_id
});
var client = createClient({
modules: {},
auth: oauth
});
@daguitosama
daguitosama / wix_api.ts
Created July 27, 2023 18:35
Dago's Wix Headless SDK / API Interface
import {
createClient,
ApiKeyStrategy,
OAuthStrategy,
media,
Tokens,
OauthData,
LoginState
// Tokens // for the future
} from "@wix/api-client";
@daguitosama
daguitosama / checkout.tsx
Created July 27, 2023 18:39
Wix Headless Checkout handler (Remix Route)
import { defer, json, redirect } from "@remix-run/cloudflare";
import type { ActionArgs, LinksFunction, LoaderArgs, V2_MetaFunction } from "@remix-run/cloudflare";
import { thirty_days_from_now } from "~/lib/lib.server";
export async function loader({ params, request, context }: LoaderArgs) {
const { session_storage, wix_cart_api } = context;
const session = await session_storage.getSession(request.headers.get("Cookie"));
const stored_cat_id = session.get("cart_id") as string;
console.log(`\r\t -> cart_id: `, stored_cat_id);
if (typeof stored_cat_id != "string") {
@daguitosama
daguitosama / shop.account.tsx
Created August 6, 2023 19:26
Wix User Auth Contenxt Layer
import {
Outlet,
isRouteErrorResponse,
useLoaderData,
useOutletContext,
useRouteError
} from "@remix-run/react";
import { createClient, LoginState, OAuthStrategy, Tokens, WixClient } from "@wix/api-client";
import type { LoaderArgs } from "@remix-run/server-runtime";
import { json } from "@remix-run/cloudflare";
@daguitosama
daguitosama / bogo.note.ts
Last active August 20, 2023 16:50
BOGO feature exploration
import { createClient, OAuthStrategy } from "@wix/api-client";
import { cart } from "@wix/ecom";
import { CreateCartOptions } from "@wix/ecom/build/cjs/src/ecom-v1-cart-cart.universal";
const WIX_STORES_APP_ID = "1380b703-ce81-ff05-f115-39571d94dfcd";
const wixClient = createClient({
modules: { cart },
auth: OAuthStrategy({ clientId: "ID" })
});
import {
createClient,
ApiKeyStrategy,
OAuthStrategy,
media,
Tokens,
OauthData,
LoginState
// Tokens // for the future
} from "@wix/api-client";
@daguitosama
daguitosama / add-srcset-to-image-data.php
Last active August 9, 2024 18:23
Add srcSet data to Images on WooCommerce REST API response
<?php
/*
Plugin Name: Add SRCSET data to images
Description: Adds srcset information to WooCommerce product images in the REST API.
Version: 1.0
Author: Dago
*/
add_filter('woocommerce_rest_prepare_product_object', 'add_srcset_to_product_images', 10, 3);
@daguitosama
daguitosama / keepKeys.js
Created October 24, 2024 15:49
Removes all the specified keys from a JSON file and prints the cleaned result back
const fs = require("fs");
const path = require("path");
/**
* Function to keep only specified keys in an object.
* @param {Object} obj - The object to filter.
* @param {Array<string>} keysToKeep - The keys to keep in the object.
* @returns {Object} - A new object with only the specified keys.
*/
function keepObjectKeys(obj, keysToKeep) {