Skip to content

Instantly share code, notes, and snippets.

View johtso's full-sized avatar
🤖

Johannes johtso

🤖
View GitHub Profile
@huw
huw / README.md
Last active March 12, 2024 21:32
Remix, Sentry & Cloudflare Workers

How to integrate Remix, Sentry, and Cloudflare Workers (incl. tracing)

The code above is just a sample—I have adapted it from a production codebase and I can't guarantee it will work as-is. It's just here to illustrate what a solution should look like.

The main things you need to do to get everything hooked up are:

  1. Rewrite instrumentBuild to accept a passed-through Hub instance, rather than using getCurrentHub() (including, perniciously, in helper functions such as hasTracingEnabled())
  2. In server/index.ts, create a root transaction from the current route’s name and wrap the loaders and actions in spans via instrumentBuild.
  3. In root.tsx, pass through your tracing & baggage into the meta function.
  4. In root.tsx, include the current domain in tracePropagationTargets (because Remix fetchers will fetch from the entire URL rather than / root, which will confuse Sentry)
  5. (Remix v2) In root.tsx, create an ErrorBoundary component (with the v2_errorBoundary flag set if you're
@colelawrence
colelawrence / createTrpcDurableObject.ts
Last active March 27, 2024 22:10
Create strongly typed Durable Objects with TRPC wrappers (requires trpc@10)
import { createTRPCProxyClient, httpLink } from "@trpc/client";
import { AnyRouter, initTRPC, MaybePromise, Router } from "@trpc/server";
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
import type { ParserWithInputOutput, ParserWithoutInput } from "@trpc/server/dist/core/parser";
import type { AnyRouterDef } from "@trpc/server/dist/core/router";
import type { ResponseMetaFn } from "@trpc/server/dist/http/internals/types";
import { getParseFn } from "./getParseFn";
export type TrpcDurableObjectRouter<Router extends AnyRouter> = {
router: Router,
@aislanmaia
aislanmaia / App.js
Last active July 20, 2022 19:00
Example for how to enable hot-reload with xstate and use-machine libraries and an example project.
import React, { useContext } from "react";
import Dashboard from "./Dashboard";
import Login from "./Login";
import AppContext from "./AppContext";
export default () => {
const { machine, error } = useContext(AppContext);
console.log("executing App component...");
return (
@whiteinge
whiteinge / Makefile
Last active December 12, 2015 01:49
A Makefile to help with Salt development
# Easily install, maintain, and cleanly reset (!) a Salt development
# installation inside a virtualenv (no need to "activate" the venv)
SRC := /home/shouse/src/salt/salt
VENV := /home/shouse/tmp/venvs/salt
BIN := $(VENV)/bin
ETC := $(VENV)/etc/salt
PKI := $(ETC)/pki
VAR := $(VENV)/var
TMP := $(VENV)/tmp
@BlinkyStitt
BlinkyStitt / building armory-qt
Last active October 31, 2016 06:13
Building BitcoinArmory on OSX up to 10.8
Instructions for 10.9 are in the works.
Install and configure brew
$ ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
$ touch ~/.bashrc
$ echo "export CFLAGS=\"-arch x86_64\"" >> ~/.bashrc
$ echo "export ARCHFLAGS=\"-arch x86_64\"" >> ~/.bashrc
$ source ~/.bashrc
$ brew update
$ brew doctor
@FiloSottile
FiloSottile / .ArmoryRPi.md
Created September 5, 2012 22:12
Building the Armory Bitcoin client for the Raspberry Pi

Armory on the RPi

Building the Armory Bitcoin client for the Raspberry Pi

This is how I got Armory (etotheipi/BitcoinArmory; http://bitcoinarmory.com/) cross-compiled for the Raspberry Pi.

This is a great way to keep an air-gapped offline wallet for only $30 dollars for the RPi (that you can also use for other things; experiment, it's awesome) and $7 for a Class 10 4GB SD card, really easy to keep in a safe and secret place.

Dependencies

@masak
masak / explanation.md
Last active April 11, 2024 02:50
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.

@danro
danro / exec.py
Created December 15, 2011 19:23
Fix for the ST2 build system exec command
import sublime, sublime_plugin
import os, sys
import thread
import subprocess
import functools
class ProcessListener(object):
def on_data(self, proc, data):
pass