swanprince's recent activity
-
Comment on What programming/technical projects have you been working on? in ~comp
-
Comment on What gifts did you give this year? in ~talk
swanprince (edited )LinkI don't have much cash to spend, and I'm terrible at coming up with cheap/thoughtful gift ideas, so I went the "services" route instead: My sister's going to school for massage therapy, and she...I don't have much cash to spend, and I'm terrible at coming up with cheap/thoughtful gift ideas, so I went the "services" route instead:
- My sister's going to school for massage therapy, and she plans to eventually start her own practice. I gave her a one time redeemable coupon for a custom-made website designed by me.
- My mom got a re-brand for her occupational therapy practice. The original brand was done by past me, and it wasn't very good.
- My dad would have gotten a built bicycle from a kit that's been sitting in his garage for 3 years, but he rejected that idea. Instead, I put some money in a Bitcoin wallet I found towards a loan he's re-paying.
Edit: I also agreed to rent a server where I'll be self-hosting whatever services they want (cloud storage, chat, email, etc.) in an attempt to de-Google the family.
-
Comment on Fortnightly Programming Q&A Thread in ~comp
swanprince (edited )Link ParentI built BadukClub using Svelte, Sapper, the Google Maps API, and Hasura, which is a GraphQL endpoint for Postgres. This is what I did: The DB File I created a single file where I took care of...I built BadukClub using Svelte, Sapper, the Google Maps API, and Hasura, which is a GraphQL endpoint for Postgres. This is what I did:
The DB File
I created a single file where I took care of initializing the connections and providing functions to interact with them. In your case, I would try something like:
const fauna = require("faunadb"); let client = null; let query = null; export function init() { init = () => {}; // this reassigns the value of init() so that it only runs once! client = new fauna.Client({ secret: YOUR_SECRET_KEY }); query = fauna.query; } // put other functions here that interact with client, query objects. Here's one to get all docs in a collection: export function getAll(collectionName) { return query.Documents(query.Collection(collectionName)); }
Then, from your
server.js
, add this:import { init as initDb } from "./path/to/db.js"; //... initDb();
Using the DB File
Now that you have a DB file, you can call methods on it. For example, if you wanted to list things out on a page of your sapper app, you'd do something like this:
src/routes/[collectionName].svelte
import { getAll } from "./path/to/db.js"; <script context="module"> export async function preload({ params: { collectionName }}) { return { collection: await getAll(collectionName), } } </script> <script> export let collection = []; </script> {#each collection as document} // do what you want with the item {/each}
Similarly, if you want to create new documents, I would have created that function in
db.js
as well, then put it in the svelte component I needed and made it accessible via a button, i.e.<button on:click={createDocument}>Click Me!</button>
Ultimately, I'd recommend trying to do as much as you can in the Svelte REPL so you get quick feedback. I set up a REPL instance that imports the Fauna library and initializes a client and the query object. Good luck!
Oh, and on the tutorial front...honestly, I don't see much value in tutorials as long as I have a bit of code to get started. The standards and frameworks for full-stack web dev change so fast that it's very difficult to find an up-to-date tutorial. I find my time better spent playing around with the libraries myself, I end up learning more that way.
-
Comment on Cameras and lenses in ~science
swanprince This article clearly explains how cameras and lenses work, along with several good visual demos. Make sure to turn JavaScript on. Honestly, the whole blog is a gold mine, and this is just the...This article clearly explains how cameras and lenses work, along with several good visual demos. Make sure to turn JavaScript on.
Honestly, the whole blog is a gold mine, and this is just the latest nugget.
-
Cameras and lenses
6 votes -
Comment on No game days. No bars. The pandemic is forcing some men to realize they need deeper friendships. in ~life.men
swanprince Yeah, I identify with this phenomenon. I had a friend group in high school, but that's gone now. I made a few friends in college, and we talk when I go to their weddings, and I usually send them...Yeah, I identify with this phenomenon. I had a friend group in high school, but that's gone now. I made a few friends in college, and we talk when I go to their weddings, and I usually send them birthday wishes and the occasional check-up text. I get the feeling that they don't have time to talk to me these days. After college, most of my male relationships were as shallow as this article described. We worked together, did outdoorsy stuff together, played games together, but it never really got deep. I text them occasionally to check up and wish them happy birthday, but it feels like they also don't have time to talk.
I do have a couple of deeper male relationships, and I'm happy I found them, but it feels like I'm always the one reaching out. Maybe everyone's just super busy, but it feels like very few people outside of my family care about me as much as I do about them. I'll keep trying though. Maybe not being on social media plays a factor, but I don't see that as a way to form deep connections.
Since I work for myself, I moved in with my parents in July 2019 to take care of them through some surgeries, and then quarantine started. I've been away from social life for about a year and a half now. I'm optimistic that when quarantine ends, I'll be able to get back out there and meet people in person. But I'm basically starting over from square one...again.
I've relaunched my personal site: https://meerific.com
It looks like a personal blog, but there's quite a bit going on behind the scenes. All the static content lives on two folders on my computer: one Backblaze B2 folder (for images) and one Dropbox folder (for written content). The website turns these folders into a blog and image gallery. Any changes I make to the content is reflected on the website within a few seconds. Additionally, any images are processed via ThumbHash, and the resulting placeholder hashes are stored in an embedded database for faster initial page loads.
The site features full-text search as well as a storefront for photo prints. The storefront is turned off for now until I find a payment provider that has IPv6 endpoints.
As the site is written in Elixir, there's very little JavaScript -- aside from the websocket connection required for reactive features. If you're wondering why there's some latency, I'm running this on a cheap IPv6 Hetzner VPS (3.20EUR/month) based in Finland. I suppose I could use a service like Fly.io to get lower latency, but it's not super critical to do so. Besides, this is my site so I can experiment and do what I want.
The code for the site is here: https://codeberg.org/meerific/www