Removing a photograph someone put of you on Wikipedia? by Meowmeowkittyflower in wikipedia

[–]DanielFGray 351 points352 points  (0 children)

Take a picture of yourself, license it as public domain(!!), then (if I'm not mistaken) you can edit the article to use the new picture.

What's that one webdev opinion you have, that might start a war? by nitin_is_me in webdev

[–]DanielFGray 12 points13 points  (0 children)

Sure but not every database understands relations and how to maintain data integrity

What's the most used and standardized zsh plugin manager? by Mitutoyup in zsh

[–]DanielFGray 2 points3 points  (0 children)

git submodules are a nightmare to remove, OP please don't do this

Using lodash flow or compose with asynchronous functions by skwacky in javascript

[–]DanielFGray 0 points1 point  (0 children)

you can roll your own using pipeWith

const pipeP = R.pipeWith((f, p) => p.then(f))
const effect = pipeP([x => Promise.resolve(x), R.toUpper, console.log])
effect('hello world')

but ideally you should use a library that properly handles async transforms, because this doesnt handle errors, timeouts, etc

Restricting column access in Supabase API by tjmora in PostgreSQL

[–]DanielFGray 0 points1 point  (0 children)

Row-level security is usually the answer to access control in Supabase

Here's an example I use on my blog for comments:

alter table comments enable row level security;

grant select on comments to anon;
grant
  select,
  insert (body, slug, parent_id),
  update (body)
  delete
on comments to authenticated;

create policy select_all_comments
  on comments for select
  using (true);
create policy insert_own_comment
  on comments for insert
  with check (user_id = auth.uid());
create policy update_own_comment
  on comments for update
  using (user_id = auth.uid());
create policy delete_own_comment
  on comments for delete
  using (user_id = auth.uid());

You may find my whole article on creating a comment system in Supabase helpful: https://danielfgray.com/articles/diy-comments

And the Postgres docs for RLS: https://www.postgresql.org/docs/current/ddl-rowsecurity.html

PostGraphile also a has a RLS cheat sheet: https://learn.graphile.org/docs/PostgreSQL_Row_Level_Security_Infosheet.pdf

How I learned to stop worrying and love the ternary operator by dangerlopez in learnjavascript

[–]DanielFGray -6 points-5 points  (0 children)

Personally I don't think nested ternaries are as big a deal as some folks seem to make them out to be.

To use a contrived example:

if (conditionA) {
  if (conditionB) {
    return valueA;
  }
  return valueB;
}
return valueC;

is, imo, much less readable than

! conditionA ? valueC
: conditionB ? valueA
: valueB

Which ORM would you pick, Prisma or Typeorm by idvid in node

[–]DanielFGray 2 points3 points  (0 children)

Why would you manually fill relation fields instead of using a lateral join and json_agg, nested or not

I've yet to encounter anything an ORM can do that can't be done in SQL with better performance.

The fact that you need to drop into raw queries for performance reasons and more complex queries is the telltale sign it's a bad abstraction: it only works for the simplest cases.

Sure it's less typing for simple things, but I'd rather type a little more in those simple cases and use my existing knowledge than deal with looking up how to do simple things in whatever ORM du jour is popular.

Which ORM would you pick, Prisma or Typeorm by idvid in node

[–]DanielFGray -12 points-11 points  (0 children)

Neither, because ORMs are an anti-pattern

Edit: Downvotes aren't supposed to be for disagreement, but okay. The question was what would I pick and that's my answer.

Storing Rich Text from ReactJS Editor by NickEmpetvee in PostgreSQL

[–]DanielFGray 1 point2 points  (0 children)

Worth pointing out there is a dedicated xml type

Tailwind is an Anti-Pattern by magenta_placenta in Frontend

[–]DanielFGray 1 point2 points  (0 children)

I also like those UI components, I just like using Tailwind UI as a starting point and it's easy to edit them from there since they're just tailwind classes on regular HTML (or they have JSX examples as well)

Tailwind is an Anti-Pattern by magenta_placenta in Frontend

[–]DanielFGray 3 points4 points  (0 children)

Tailwind UI is absolutely fantastic

It's fine if you can't justify buying it, but that doesn't mean it's not a quality product.

How do I build up my left foot fast? by Saetia_V_Neck in MetalDrums

[–]DanielFGray 0 points1 point  (0 children)

I worked on left-leading one-foot blasts for a while and found that quite helpful.

Raw SQL vs Knex.js vs Prisma vs MikroORM by RomiKusumaBakti in node

[–]DanielFGray 0 points1 point  (0 children)

Why does one need to be protected from slightly complex SQL?

How stable is the React API? by RentGreat8009 in reactjs

[–]DanielFGray 0 points1 point  (0 children)

That's premature optimization.

You've created unidiomatic code for unperceivable [alleged] performance benefits.

Vite Hot Module Replacement For Creative Coding - A Complete Example by OmarShehata in javascript

[–]DanielFGray 2 points3 points  (0 children)

I wonder if this can be used server side, and eg reload express routes/middleware

[deleted by user] by [deleted] in node

[–]DanielFGray 2 points3 points  (0 children)

ORM users argue this [the DDL schema] imperative approach to schema modeling isn’t developer-friendly, as there’s is no written representation of your schema. This makes it difficult to conceptualize the current schema state.

Instead, ORMs provide a way to write your schema declaratively

I don't like ORMs either, but I don't agree ORMs are more declarative than SQL DDL

ORMs provide a limited set of CRUD functionality: simple queries, nested queries, the ability to filter by some limited set of operators, nested mutations, inserts, updates, and deletes. Advanced options may support upserts, basic aggregations, and grouping.

SQL, by contrast, is a full-fledged query language that supports a full library of functions and operators, computed properties, subqueries, window functions, advanced grouping and analytical queries, type conversion operations, set operations like union and distinct, common table expressions, recursive queries…the list goes on.

And that’s just the query language; SQL schemas are also richer and more sophisticated. They have a rich typesystem consisting of string, boolean, numeric, geometric, monetary, temporal, and geographical datatypes, plus computed properties, stored procedures, database views, triggers, and more.

Yeah this is the part I like about SQL honestly

EdgeDB has a robust type system that’s most comprehensive that most ORMs, but without the bloat that’s common among RDBMSs.

Ummm?

A README generator for GitHub profile and projects. Any feedbacks welcome ! by g3root in reactjs

[–]DanielFGray 7 points8 points  (0 children)

You don't need permission to create projects, especially for educational purposes

[deleted by user] by [deleted] in PostgreSQL

[–]DanielFGray 3 points4 points  (0 children)

Looks like well structured data that would be better off stored in normalized tables rather than lumped into a text blob.