Skip to content

Instantly share code, notes, and snippets.

View lumenwrites's full-sized avatar

lumenwrites lumenwrites

View GitHub Profile

Many startups post articles to Hacker News in the hope of getting the community's attention. Most don't get far. They're either about topics that HN readers don't find interesting, or they're structured in a way that loses the audience. It's dismaying to see these because I can feel how much work people put into them and how disappointed they are when they sink from the /newest page without a trace. What a waste!

Below is a bunch of advice I've given to YC startups who've struggled with this over the years. The bulk of this article has been copied from old emails. Eventually I'll wrangle it into something publishable.

@lumenwrites
lumenwrites / usingpusher.tsx
Created January 17, 2022 19:20
Pusher useEffect
useEffect(() => {
// Pusher.logToConsole = true
let pusher = new Pusher(process.env.NEXT_PUBLIC_PUSHER_KEY, {
cluster: process.env.NEXT_PUBLIC_PUSHER_CLUSTER,
})
window.onbeforeunload = function () {
pusher.disconnect()
}
let channel = pusher.subscribe('story-engine')
channel.bind('place-card', function (data) {
@lumenwrites
lumenwrites / 0. About.txt
Last active November 29, 2021 17:44
Vercel Throttling Issue
1. index.tsx has getServerSideProps() function which calls a getPosts() function to fetch the posts.
2. get-posts.ts runs a prisma query and fetches the posts.
3. it uses prismaClient
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"id": "https://social.example/alyssa/posts/9282e9cc-14d0-42b3-a758-d6aeca6c876b",
"to": ["https://social.example/alyssa/followers/",
"https://www.w3.org/ns/activitystreams#Public"],
"author": "https://social.example/alyssa/",
"object": {
"type": "Note",
"id": "https://social.example/alyssa/posts/d18c55d4-8a63-4181-9745-4e6cf7938fa1",
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"id": "https://chatty.example/ben/p/51086",
"to": ["https://social.example/alyssa/"],
"inReplyTo": "https://social.example/alyssa/posts/49e2d03d-b53a-4c4c-a95c-94a6abf45a19",
"author": "https://chatty.example/ben/",
"object": {
"type": "Note",
"id": "https://chatty.example/ben/p/51085",
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"id": "https://social.example/alyssa/posts/a29a6843-9feb-4c74-a7f7-081b9c9201d3",
"to": ["https://chatty.example/ben/"],
"author": "https://social.example/alyssa/",
"object": {
"type": "Note",
"id": "https://social.example/alyssa/posts/49e2d03d-b53a-4c4c-a95c-94a6abf45a19",
"attributedTo": "https://social.example/alyssa/",
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Note",
"to": ["https://chatty.example/ben/"],
"attributedTo": "https://social.example/alyssa/",
"content": "Say, did you finish reading that book I lent you?"
}
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Person",
"id": "https://social.example/alyssa/",
"name": "Alyssa P. Hacker",
"preferredUsername": "alyssa",
"summary": "Lisp enthusiast hailing from MIT",
"inbox": "https://social.example/alyssa/inbox/",
"outbox": "https://social.example/alyssa/outbox/",
"followers": "https://social.example/alyssa/followers/",
@lumenwrites
lumenwrites / like-activity.json
Last active April 19, 2017 23:19
ActivityPub
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Like",
"id": "https://social.example/alyssa/posts/5312e10e-5110-42e5-a09b-934882b3ecec",
"to": ["https://chatty.example/ben/"],
"author": "https://social.example/alyssa/",
"object": "https://chatty.example/ben/p/51086"
}
@lumenwrites
lumenwrites / mastodon_nginx.conf
Created April 10, 2017 19:01
Mastodon nginx conf
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
# redirect from http to https
listen 80 default_server;
listen [::]:80 default_server;
server_name hackertribe.io www.hackertribe.io;