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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crypto from "node:crypto"; | |
import { ChatPromptTemplate } from "@langchain/core/prompts"; | |
import { ChatOpenAI } from "@langchain/openai"; | |
import { eventTrigger } from "@trigger.dev/sdk"; | |
import { capitalCase } from "change-case"; | |
import * as d3 from "d3-dsv"; | |
import { CSVLoader } from "langchain/document_loaders/fs/csv"; | |
import { TokenTextSplitter } from "langchain/text_splitter"; | |
import { z } from "zod"; | |
import { client, supabase } from "../client"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note: this gist is a part of this OSS project that I'm currently working on: https://github.com/steven-tey/dub | |
export default async function getTitleFromUrl (url: string) { | |
const controller = new AbortController(); | |
const timeoutId = setTimeout(() => controller.abort(), 2000); // timeout if it takes longer than 2 seconds | |
const title = await fetch(url, { signal: controller.signal }) | |
.then((res) => { | |
clearTimeout(timeoutId); | |
return res.text(); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* One liner to convert a base64 string to a binary Uint8Array | |
* | |
* Example: | |
* const dataURL = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2w....'; | |
* console.log(convertDataURIToBinary(dataURL)); | |
*/ | |
const convertDataURIToBinary = dataURI => | |
Uint8Array.from(window.atob(dataURI.replace(/^data[^,]+,/,'')), v => v.charCodeAt(0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cazooApiUrl = "https://www.cazoo.co.uk/api/search?sort=createdAt-desc&runningCosts=ulezChargeExempt&fuelType=Petrol%2CElectric%2CPlug_in_Hybrid%2CHybrid&gearbox=Automatic&ownershipType=purchase&maxMonthlyPrice=280"; | |
const discordWebhookUrl = "https://discord.com/api/webhooks/ENTER_YOUR_WEBHOOK" | |
/* | |
For this to work, you need to setup Workers KV https://developers.cloudflare.com/workers/runtime-apis/kv | |
Here, my KV namespace is called CAZOO | |
For the worker to actually get triggered, you'll also need to set up a cron job from the Workers UI in Cloudflare | |
*/ | |
async function handleRequest() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: https://twitter.com/calebporzio/status/1151876736931549185 | |
<div class="flex"> | |
<aside class="h-screen sticky top-0"> | |
// Fixed Sidebar | |
</aside> | |
<main> | |
// Content | |
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from 'react' | |
import Head from 'next/head' | |
const CLOUD_NAME = '<name here>' | |
export default class ImageUploader extends Component { | |
constructor(props) { | |
super(props) | |
this.uploader = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
city.names <- c("A", "B", "C", "D", "E", "F", "G", "H") | |
observed.turnout = c(18, 30, 14, 52, 24, 29, 48, 49) | |
observed.diffmeans <- mean(observed.turnout[c(2,4,6,8)]) - | |
mean(observed.turnout[c(1,3,5,7)]) | |
print(observed.diffmeans) | |
foo <- as.data.frame(city.names, observed.turnout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add on element with overflow | |
-webkit-mask-image: -webkit-radial-gradient(white, black); |