Skip to content

Instantly share code, notes, and snippets.

@xixixao
xixixao / Error.md
Created July 24, 2024 12:48
Error using Clerk with TanStack Start

When I follow https://www.npmjs.com/package/@clerk/tanstack-start the auth works but I'm getting the following errors in the browser:

Warning: Expected server HTML to contain a matching <script> in <div>.
    at script
    at Asset (http://localhost:3002/_build/node_modules/.vinxi/cache/client/deps/chunk-OCEAE7RH.js?v=ef51fe27:274:3)
    at ClerkProvider2 (http://localhost:3002/_build/node_modules/.vinxi/cache/client/deps/@clerk_tanstack-start.js?v=ef51fe27:4396:27)
    at RootComponent (http://localhost:3002/_build/app/routes/__root.tsx?t=1721825015217:43:18)
    at MatchInner (http://localhost:3002/_build/node_modules/.vinxi/cache/client/deps/chunk-JBDZ2WVL.js?v=ef51fe27:3620:23)
    at SafeFragment (http://localhost:3002/_build/node_modules/.vinxi/cache/client/deps/chunk-JBDZ2WVL.js?v=ef51fe27:3542:87)
    at CatchBoundaryImpl (http://localhost:3002/_build/node_modules/.vinxi/cache/client/deps/chunk-JBDZ2WVL.js?v=ef51fe27:1214:5)
@xixixao
xixixao / mockConvexReactClient.ts
Created June 18, 2024 10:35
Mock Convex React client wip
/* eslint-disable class-methods-use-this */
import { captureMessage } from "@sentry/nextjs";
import { ConvexReactClient, Watch } from "convex/react";
import { getFunctionName, FunctionReference } from "convex/server";
import { ReactNode, useEffect } from "react";
import { usePrevious } from "react-use";
import { toast as sonnerToast } from "sonner";
export async function copyTextToClipboard(text: string) {
if ("clipboard" in navigator) {
@xixixao
xixixao / report.md
Created January 20, 2024 07:49
issue getting rewrites and clerk work

We're trying to use vercel rewrites to serve multiple projects under different paths on the same domain. The one I'm working on is using Next.js 14.

Right now I'm using dev clerk instance, but I can't get it to work.

I think the issue is related to this one: clerk/javascript#1740

I am getting these errors:

 authenticateRequest state is interstitial, {
import { Link } from "@remix-run/react";
import { useQuery } from "../../convex/_generated/react";
export const meta = () => {
return [{ title: "New Remix App" }];
};
export default function Index() {
const tasks = useQuery("getTasks");
return (
@xixixao
xixixao / scrollview.rs
Created February 13, 2023 04:41
Better ScrollView for tui-rs
use tui::{
buffer::Buffer,
layout::Rect,
style::Style,
text::{Spans, Text},
widgets::{Block, StatefulWidget, Widget},
};
use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr;
@xixixao
xixixao / test_bmesh_ops.py
Last active November 6, 2022 01:00
Testing the signature of all bmesh ops
raw_mesh = bmesh.new()
# setup
bmesh.ops.create_cube(raw_mesh)
raw_mesh.verts.ensure_lookup_table()
# end of setup
bmesh.ops.smooth_vert(raw_mesh)
bmesh.ops.smooth_laplacian_vert(raw_mesh)
bmesh.ops.recalc_face_normals(raw_mesh)
@xixixao
xixixao / bmesh_api_docs.diff
Last active November 6, 2022 00:50
Changes caused by D16400
diff --git a/doc/python_api/rst/bmesh.ops.rst b/doc/python_api/rst/bmesh.ops.rst
index cfd99c1..e44eab5 100644
--- a/doc/python_api/rst/bmesh.ops.rst
+++ b/doc/python_api/rst/bmesh.ops.rst
@@ -15,7 +15,7 @@ Operator Example
This script shows how operators can be used to model a link of a chain.
.. literalinclude:: __/examples/bmesh.ops.1.py
-.. function:: smooth_vert(bm, verts, factor, mirror_clip_x, mirror_clip_y, mirror_clip_z, clip_dist, use_axis_x, use_axis_y, use_axis_z)
+.. function:: smooth_vert(bm, verts=[], factor=0, mirror_clip_x=False, mirror_clip_y=False, mirror_clip_z=False, clip_dist=0, use_axis_x=False, use_axis_y=False, use_axis_z=False)
@xixixao
xixixao / drawBetterSelection.js
Last active June 13, 2021 04:40
Mac-like selection background for Codemirror6
import { drawSelection, ViewPlugin, Direction } from "@codemirror/view";
import { combineConfig, Facet, EditorSelection } from "@codemirror/state";
const [_, _2, hideNativeSelection] = drawSelection();
const selectionConfig = Facet.define({
combine(configs) {
return combineConfig(
configs,
{
@xixixao
xixixao / testfile.js
Created June 12, 2017 00:28
Test file
/**
* Given the starting source, starting position, and the ending source this
* function guesses where the cursor should move to.
*/
function updateCursor(
startSource: string,
startPosition: {row: number, column: number},
endSource: string,
): {row: number, column: number} {
for (const accuracy of ACCURACIES) {
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string>CoffeeScript</string>
<key>fileTypes</key>
<array>
<string>coffee</string>
<string>Cakefile</string>