Skip to content

Instantly share code, notes, and snippets.

View rafaelrcamargo's full-sized avatar
🦀
Borrow checking

rafael r. camargo rafaelrcamargo

🦀
Borrow checking
View GitHub Profile
@KristofferEriksson
KristofferEriksson / useTextSelection.ts
Last active February 24, 2024 22:22
A React Typescript hook that tracks user text selections & their screen positions
import { useEffect, useState } from "react";
type UseTextSelectionReturn = {
text: string;
rects: DOMRect[];
ranges: Range[];
selection: Selection | null;
};
const getRangesFromSelection = (selection: Selection): Range[] => {
@KristofferEriksson
KristofferEriksson / useShare.ts
Created February 7, 2024 22:19
A React Typescript hook that let users share your content directly via native share dialogs
import { useCallback, useEffect, useState } from "react";
// Types for the useShare hook parameters
interface UseShareParams {
onShare?: (content: ShareParams) => void;
onSuccess?: (content: ShareParams) => void;
onError?: (error: any) => void;
fallback?: () => void;
successTimeout?: number;
}
@veekaybee
veekaybee / normcore-llm.md
Last active May 9, 2024 07:47
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

@Merott
Merott / tailwind-colors-as-css-variables.md
Last active April 26, 2024 11:06
Expose Tailwind colors as CSS custom properties (variables)

This is a simple Tailwind plugin to expose all of Tailwind's colors, including any custom ones, as custom css properties on the :root element.

There are a couple of main reasons this is helpful:

  • You can reference all of Tailwind's colors—including any custom ones you define—from handwritten CSS code.
  • You can define all of your colors within the Tailwind configuration, and access the final values programmatically, which isn't possible if you did it the other way around: referencing custom CSS variables (defined in CSS code) from your Tailwind config.

See the Tailwind Plugins for more info on plugins.

@fnky
fnky / ANSI.md
Last active May 10, 2024 03:35
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@tobsn
tobsn / info.txt
Last active November 6, 2023 21:41 — forked from rpgreen/master.vm
API Gateway "Send Everything" Mapping Template
https://rpgreen.wordpress.com/2016/02/23/a-mapping-template-to-send-everything-to-your-backend-integration/
location/cookie headers:
https://stackoverflow.com/questions/35595672/aws-api-gateway-use-302-redirect-and-set-cookie-header
https://blog.hiramsoftware.com/blog/day-one-aws-api-gateway/
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007