10,000 Matching Annotations
  1. Apr 2022
    1. You don’t need microsecond timing on a freaking website – except maybe in graphics and sound, and such functionality could be wrapped and secured in an API. So think that browser makers deserve a bigger slice of blame for making their users so vulnerable. User safety needs to become important again.
    1. Let's imagine your project talks to databases, supports several, and has adapters for each one of them. Those adapters may have top-level require calls that load their respective drivers: # my_gem/db_adapters/postgresql.rb require "pg" but you don't want your users to install them all, only the one they are going to use.
    2. In that line, if two loaders manage files that translate to the same constant in the same namespace, the first one wins, the rest are ignored. Similar to what happens with require and $LOAD_PATH, only the first occurrence matters.
    3. It is very important that your gem reopens the modules ActiveJob and ActiveJob::QueueAdapters instead of defining them. Because their proper definition lives in Active Job. Furthermore, if the project reloads, you do not want any of ActiveJob or ActiveJob::QueueAdapters to be reloaded. Bottom line, Zeitwerk should not be managing those namespaces. Active Job owns them and defines them. Your gem needs to reopen them.
    4. Zeitwerk raises Zeitwerk::UnsynchronizedReloadError if any of these situations are detected. This is a fatal exception that signals a fundamental bug, you cannot rescue it and expect things to work.
    1. You need to tell the main autoloader to ignore the directory with the overrides, and you need to load them with load instead. Something like this: overrides = "#{Rails.root}/app/overrides" Rails.autoloaders.main.ignore(overrides) config.to_prepare do Dir.glob("#{overrides}/**/*_override.rb").each do |override| load override end end
    1. export RUBY_THREAD_VM_STACK_SIZE=2000000

      This example is how to make stack size larger, but my use case is actually needing to make it smaller.

      Why? Because I was debugging a bug that was causing a SystemStackError and it took a long time to hit the stack size limit. In order to iterate more quickly (run my test that exercised the problem code), I wanted to set the stack size smaller, so I did:

      export RUBY_THREAD_VM_STACK_SIZE=200

    1. The final piece that's pushing the two first crucial changes over the paradigm hill is import maps. They allow the use of logical references for modules in ES6 (also known as ESM), rather than explicit file references.
    1. The heart of Hotwire is Turbo. A set of complementary techniques for speeding up page changes and form submissions, dividing complex pages into components, and stream partial page updates over WebSocket. All without writing any JavaScript at all. And designed from the start to integrate perfectly with native hybrid applications for iOS and Android.
  2. www.hey.com www.hey.com
    1. All that can be forgiven, but not charging $10 USD for this bundle worsener (they dumped it very quick into shovelware game bundles). $10 gets you a lot of great games on Steam like Frostpunk, Metro and Skyrim, so it's impossible to ask anyone considers this against the competition.
    2. what looks like a Unity Asset Store flipped robot

      Too harsh. What, so nothing from the Asset Store -- not even, let's see, assets! -- are ever allowed to be used in a finished game??

    3. Grundsätzlich eine nette Idee. Aber an der Umsetzung hapert es. Mein Roboter stößt manchmal gegen unsichtbare Wände oder wird plötzlich in die Luft geschleudert. Zudem wird das Spielprinzip aufgrund der eingeschränkten Bewegungsmöglichkeiten und der immer gleichen Texturen sehr schnell langweilig.
    1. I found something wired! I had a target=blank in my kindergarten.svelte file that when I click on a link that opens in a new tab , in that tab when I click on other links page doesn't load without refresh! It's a little bit confusing !

      doesn't make sense

    1. In fact, "stuff" was a better name. If I said "put it in the context", there were like 15 things in the codebase called "context", but "put it in stuff", well, there's only one thing called "stuff". Because no one else was brave/silly enough to use that name.

      naming

    2. I suppose most systems use a word like "context", "environment", "data", "info", "headers", "metadata"... but those words really aren't any more descriptive, now are they! They are just stuff!

      naming

    1. Since context just fits best if it wasn't taken already, I propose layoutContext or loadContext to show a) the semantic similarity to contexts but b) make it visible that this is different and belongs to a specific part.
    1. it's the fact that Microsoft hasn't prioritized this work. There's nothing magical about Blink or V8 that makes the Chrome password manager better than Edge's; it's just that Google has taken the time to do the work.

      .

    1. These callbacks are focused on the transactions, instead of specific model actions.

      At least I think this is talking about this as limitation/problem.

      The limitation/problem being that it's not good/useful for performing after-transaction code only for specific actions.

      But the next sentence "This is beneficial..." seems contradictory, so I'm a bit confused/unclear of what the intention is...

      Looking at this project more, it doesn't appear to solve the "after-transaction code only for specific actions" problem like I initially thought it did (and like https://github.com/grosser/ar_after_transaction does), so I believe I was mistaken. Still not sure what is meant by "instead of specific model actions". Are they claiming that "before_commit_on_create" for example is a "specific model action"? (hardly!) That seems almost identical to the (not specific enough) callbacks provided natively by Rails. Oh yeah, I guess they do point out that Rails 3 adds this functionality, so this gem is only needed for Rails 2.

    1. This would work if your transaction only wraps a single model's save operation. I need to wrap at least Node + Version + Attachment

      looking for a callback that you can register to happen after current transaction is committed, not just after_commit of model -- though actually, that might fire precisely when current transaction is committed, too (except that it might only get triggered for nested transactions, not the top-most transaction), so it could maybe go there ... but I think the problem is just that it doesn't belong there, because it's not specific to the model...

      I guess the OP said it best:

      I am not looking for model based after commits on update/create/etc, I want to be able to dynamically define a block that will be executed only if the current (top-most) transaction passes:

    1. Making one Comment query per Post is too expensive; it’s N+1 queries (one to fetch the posts, N to fetch the comments). You could use includes to preload all the comments for all the posts, but that requires hydrating hundreds of thousands of records, even though you only need a few hundred for your front page. What you want is some kind of GROUP BY with a LIMIT on each group — but that doesn’t exist, either in Activerecord nor even in postgres. Postgres has a different solution for this problem: the LATERAL JOIN.
    1. join = Arel::Nodes::NamedFunction.new('json_b_array_elements', [Arel::Nodes::SqlLiteral.new("subscriptions")]) .as(Arel::Nodes::NamedFunction.new('sd', [Arel::Nodes::SqlLiteral.new("subscription_data")]).to_sql) p = e.project( Arel::Nodes::SqlLiteral.new( Arel::Nodes::Grouping.new( Arel::Nodes::InfixOperation.new('->>', sd[:subscription_data], Arel::Nodes::SqlLiteral.new("'id'"))).to_sql) << '::uuid' ).where( Arel::Nodes::InfixOperation.new('->>', sd[:subscription_data], Arel::Nodes::SqlLiteral.new("'type'").eq( Arel::Nodes::SqlLiteral.new("'Company'") ) ).and(e[:slug].eq(event_slug))) p.join_sources << Arel::Nodes::StringJoin.new( Arel::Nodes::SqlLiteral.new('CROSS JOIN LATERAL')) << join
    1. c2 = Comment.arel_table.alias s1 = Comment.arel_table. project(c2[:user_id], c2[:created_at].maximum.as('max_created_at')). from(c2).group('user_id').as('s1') puts s1.to_sql # (SELECT "comments_2"."user_id", MAX("comments_2"."created_at") AS max_created_at # FROM "comments" "comments_2" GROUP BY user_id) s1

      as() to give subselect an alias

    1. Generates the following sql in sqlite3: "SELECT \"patients\".* FROM \"patients\" INNER JOIN \"users\" ON \"users\".\"id\" = \"patients\".\"user_id\" WHERE (\"users\".\"name\" LIKE '%query%')" And the following sql in postgres (notice the ILIKE): "SELECT \"patients\".* FROM \"patients\" INNER JOIN \"users\" ON \"users\".\"id\" = \"patients\".\"user_id\" WHERE (\"users\".\"name\" ILIKE '%query%')" This allows you to join with simplicity, but still get the abstraction of the ARel matcher to your RDBMS.
    1. def self.current_table_name current_table = current_scope.arel.source.left case current_table when Arel::Table current_table.name when Arel::Nodes::TableAlias current_table.right else fail end end
    1. A major issue with G Suite legacy free accounts is that they act as Google accounts for the whole Google ecosystem. In addition to emails, calendar events and contacts, some users with G Suite legacy free accounts have been using those accounts with YouTube, Google Maps, purchases on Google Play, Google Drive and more.

      free not free

    1. I've hosted close friend's and family's email for a decade now on an old G Apps instance. We only ever used it for email on a custom domain.

      free no longer free

    1. where the balance is between optimal behavior and having to ship a whole bunch of attribute/property lookup information to the browser with the app whenever someone uses spread attributes.
    1. Taking a look at the ~20 svelte form solutions out there, this either means the market is now filled with good solutions, or, like with the many flutter state management libraries, all current solutions are not good enough.

      tautology?

    1. FWIW, I'm using triggers to get around AR's habit of sending NULL instead of DEFAULT: create function medias_insert_make_uuid() returns trigger as $$ begin NEW.uuid := random_characters(12); return NEW; end $$ language plpgsql; create trigger medias_insert_make_uuid before insert on medias for each row execute procedure medias_insert_make_uuid();
    2. If I create a model ActiveRecord sends NULL values for every field that is not defined. Postgres dutifully writes the NULL value into the field instead of the default value. Activerecord should either send nothing (preferable) or send DEFAULT.
    1. You are not allowed to automate the Gmail interface, whether to send, delete, or filter emails, in a manner that misleads or deceives users.

      key words: in a manner that misleads or deceives users.

      automation in itself is not bad

    2. When Gmail users mark emails as spam, it increases the likelihood that future messages you send will also be classified as spam by our anti-abuse systems.

      .

    1. So no, nnn doesn't try to guess your environment and use-cases and per-decide workflows. It tries to remain generic with sane examples (in the form of plugins) to extend the functionality.

      generic

      extensible

      good design

    1. Setting "img max-width:100%" is a technique employed in responsive/fluid web site design so that images re-size proportionally when the browser is re-sized. Apparently some css grid systems have started setting this style by default. More info about fluid images here: http://www.alistapart.com/articles/fluid-images/
    1. I know about the interpolation brackets method, but what if the selector is deeper in the three, for example three of four layers deep? I only want its parent selector to be duplicated, not the whole selector tree.

      nuanced problem

    1. When a web page is viewed on a screen with a large physical size (assuming a maximised browser window), the author might wish to include some less relevant parts surrounding the critical part of the image. When the same web page is viewed on a screen with a small physical size, the author might wish to show only the critical part of the image.
    1. Assumes you're using screen 0 (if you didn't know that displays could have more than one screen, ignore this).

      if you didn't know that ..., ignore this :)

  3. Mar 2022
    1. X clipboard The X window system has its own clipboard. It is also known as a cutbuffer. Any text or content you mark by highlighting with the mouse cursor is automatically copied to this clipboard. This is known as the PRIMARY selection or X Window selection or just selection in X jargon. When you middle-click the mouse cursor at the destination location, this copied content is pasted there.
    1. The while(true) is not a problem because the loop contains sleep 0.5 which relinquishes half a second of CPU time in each of the loop's iterations. Because of that (and the lightweightness of the xsel command invocation which comprises the other part of the loop), the CPU resources taken up by the loop will be exceedingly tiny even on the slowest of Ubuntu machines.
    2. While this isn't a solution, hopefully this explanation will make it clear WHY. In Ubuntu there are two clipboards at work. One, which everyone is familiar with, the freedesktop.org clipboard (captures Ctrl+C command) The second is a clipboard manager that has been at play since before Ubuntu even existed - X11. The X Server (X11) manages three other clipboards: Primary Selection, Secondary Selection, and Clipboard. When you select text with your pointer it gets copied to a buffer in the XServer, the Primary Selection, and awaits pasting by means of the Mouse 3 button. The other two were designed to be used by other applications in a means to share a common clipboard between applications. In this case the freedesktop.org clipboard manager in Ubuntu already does this for us.
    3. I realize this isn't an ideal solution - but seems to be the truth to the issue. The only relevant solution I could muster is actually a hack, create a script that executes an infinite while loop that just replaces the Primary Selection with a null value.