Skip to content

Instantly share code, notes, and snippets.

@cj
cj / [trpc].ts
Created August 23, 2022 03:05
Astro trpc client handler
import { appRouter } from 'server'
import type { APIContext } from 'astro'
import { resolveHTTPResponse } from '@trpc/server'
import type { HTTPHeaders } from '@trpc/client'
/**
* Handles trpc query client requests.
*
* @param {APIContext} - Astro API Context
* @returns {Promise<Response>} - trpc response
@cj
cj / @remix-run+dev+1.0.6.patch
Created December 14, 2021 17:09
Remix Transpile Modules
diff --git a/node_modules/@remix-run/dev/compiler.js b/node_modules/@remix-run/dev/compiler.js
index 22c5ac0..bb8ae60 100644
--- a/node_modules/@remix-run/dev/compiler.js
+++ b/node_modules/@remix-run/dev/compiler.js
@@ -352,6 +352,7 @@ async function createServerBuild(config, options) {
} // allow importing css files for bundling / hashing from node_modules.
+ if (config.transpileModules.includes(id)) return false;
if (id.endsWith(".css")) return false;
@cj
cj / @remix-run+dev+1.0.6.patch
Last active December 1, 2021 21:29
graphql file support for remix.run
diff --git a/node_modules/@remix-run/dev/compiler.js b/node_modules/@remix-run/dev/compiler.js
index 22c5ac0..eb1f7c4 100644
--- a/node_modules/@remix-run/dev/compiler.js
+++ b/node_modules/@remix-run/dev/compiler.js
@@ -28,6 +28,7 @@ var loaders = require('./compiler/loaders.js');
var mdx = require('./compiler/plugins/mdx.js');
var routes = require('./compiler/routes.js');
var fs$1 = require('./compiler/utils/fs.js');
+var graphqlLoaderPlugin = require('@luckycatfactory/esbuild-graphql-loader').default;
@cj
cj / server.ts
Created November 13, 2021 16:55
blitzjs krabs custom server
import blitz from 'blitz/custom-server'
import { createServer } from 'http'
import { log } from '@blitzjs/display'
import krabs from 'krabs'
const { PORT = '3000' } = process.env
const dev = process.env.NODE_ENV !== 'production'
const app = blitz({ dev })
const handle = app.getRequestHandler()
@cj
cj / krabs+0.1.3.patch
Last active November 14, 2021 20:45
Krabs - allow common pages
diff --git a/node_modules/krabs/dist/express-krabs/index.js b/node_modules/krabs/dist/express-krabs/index.js
index 493254f..fdd3318 100644
--- a/node_modules/krabs/dist/express-krabs/index.js
+++ b/node_modules/krabs/dist/express-krabs/index.js
@@ -86,7 +86,7 @@ function krabs(req, res, handle, app, config) {
}
return [2 /*return*/];
}
- route = resolve_1["default"](tenant.name, String(pathname));
+ route = resolve_1["default"](tenant.name, String(pathname), tenant.commonPages);
$ sudo apt-get update
$ sudo apt-get install unzip wget
$ wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
$ unzip ngrok-stable-linux-amd64.zip
$ sudo mv ./ngrok /usr/bin/ngrok
$ ngrok
<s:Envelope
xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT</a:Action>
<a:MessageID>urn:uuid:5382e44f-1711-4291-8e6d-64086192e485</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
@cj
cj / 1_welcome.txt
Created February 13, 2020 06:21 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
Before you doom yourself, there are a few things you should know:
1. Whenever you edit your doom! block in ~/.doom.d/init.el or modify your
modules, run:
bin/doom refresh
This will ensure all needed packages are installed, all orphaned packages are
removed, and your autoloads files are up to date. This is important! If you
forget to do this you will get errors!
@cj
cj / doom.txt
Created February 13, 2020 06:20 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
import compat from 'preact/compat'
export * from 'preact/compat';
export default compat;