Skip to content

Instantly share code, notes, and snippets.

View thomasfr's full-sized avatar

Thomas Fritz thomasfr

View GitHub Profile
@nrdobie
nrdobie / README.md
Last active February 21, 2024 18:16
Use CUID2 with Prisma

This will automatically use CUID2 for all id fields when creating elements in Prisma.

You'll need to add the following libraries to make this work

npm install --save @paralleldrive/cuid2 immer
yarn add @paralleldrive/cuid2 immer
pnpm add @paralleldrive/cuid2 immer
@tappleby
tappleby / server.ts
Created April 8, 2023 02:06
Sample remix handler based on remix-architect that supports AWS Lambda Streaming - https://aws.amazon.com/blogs/compute/introducing-aws-lambda-response-streaming/
import { createRequestHandler } from "./streaming-lambda.ts";
import * as build from "@remix-run/dev/server-build";
export const handler = awslambda.streamifyResponse(
createRequestHandler({
build,
mode: process.env.NODE_ENV,
})
);
@ptenteromano
ptenteromano / photos.tsx
Last active March 28, 2024 10:42
Infinite Scroll with Remix Run
/*
* Infinite Scroll using Remix Run
* Based on client-side Scroll position
* Full Article here: https://dev.to/ptenteromano/infinite-scroll-with-remix-run-1g7
*/
import { useEffect, useState, useCallback } from "react";
import { LoaderFunction, useLoaderData, useFetcher } from "remix";
import { fetchPhotos } from "~/utils/api/restful";
import type { PhotoHash } from "~/utils/api/types";
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@jgrahamc
jgrahamc / pwnd.js
Created February 24, 2018 16:36
Cloudflare Workers that adds an "Cf-Password-Pwnd" header to a POST request indicating whether the 'password' field appears in Troy Hunt's database of pwned passwords.
addEventListener('fetch', event => {
event.respondWith(fetchAndCheckPassword(event.request))
})
async function fetchAndCheckPassword(req) {
if (req.method == "POST") {
try {
const post = await req.formData();
const pwd = post.get('password')
const enc = new TextEncoder("utf-8").encode(pwd)
@ryyppy
ryyppy / proposal.md
Last active May 20, 2023 02:07
A Life on a Commandline - How to never touch a mouse again. Lightning Talk Proposal for ReactiveConf 2016 (https://reactiveconf.com/)

Proposal for this year's Reactive lightning talks @ReactiveConf - If you want to see my talk, star this gist please :-) [Reactive Blogpost][reactive-conference-blogpost]


A life on a Commandline

As a JavaScript developer, could you imagine using something else than Atom, Sublime or other IDE-like text-editors? During their daily work, people wrangle a lot with different applications, editors, windows, browsers and loose a lot of time because of their tools getting in their way.

@denji
denji / golang-tls.md
Last active April 29, 2024 03:39 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active May 1, 2024 23:17
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@jexp
jexp / neo.sh
Last active May 18, 2016 17:44
#!/bin/bash
# usage neo.sh [-h host:port] [-u user:pass] [cmd]
# end cypher statements with semicolon
# terminate read loop with ^d or return
HOST="localhost:7474"
if [ "$1" == "-h" ]; then
shift; HOST="$1";shift;
fi
AUTH=""

A case of nested subcategories

In many multilingual systems, there are nested hierarchis of categories, connected to different products that need to be searched by customers with different language preferences. Here is a possible approach, inspired by the Wordnet Project.

The setup