630 Matching Annotations
  1. Last 7 days
    1. For example, if I make an application (Client) that allows a user (Resource Owner) to make notes and save them as a repo in their GitHub account (Resource Server), then my application will need to access their GitHub data. It's not secure for the user to directly supply their GitHub username and password to my application and grant full access to the entire account. Instead, using OAuth 2.0, they can go through an authorization flow that will grant limited access to some resources based on a scope, and I will never have access to any other data or their password.
  2. Nov 2022
    1. Post.in_order_of(:type, %w[Draft Published Archived]).order(:created_at).pluck(:name) which generates SELECT posts.name FROM posts ORDER BY CASE posts.type WHEN 'Draft' THEN 1 WHEN 'Published' THEN 2 WHEN 'Archived' THEN 3 ELSE 4 END ASC, posts.created_at ASC
  3. Oct 2022
    1. Your alternator is NOT a chargerThe alternator’s job is to supply the power needed for all electrical items on the vehicle, plus replenish the battery from the last start up. The alternator is not a battery charger so much as it is a battery maintainer. If the alternator has to recharge an overly discharged battery, the alternator will become over-worked, which will shorten its life.If you use your alternator to charge your dead battery, you will overheat the alternator during its charging process. The greater the amperage flowing through it, the higher the heat an alternator creates.Maximum Alternator Output Only Occurs at high RPMSAfter you start your car with jumper cables, the voltage regulator sees a discharged battery and commands maximum field in the rotor. But at 600 RPM, the alternator can only provide about 1/4th of its rated output. Let it idle for a long period and all you’ll do it overheat the rotor windings and burn up your expensive alternator. A 110-amp alternator can only output 110-amps at RPMS of 2,500 or more. So don’t even think about letting it idle to recharge the battery.A battery charger costs $40. A new Alternator $350Not exactly brain surgery, is it?The correct way to deal with this situation is to jump the battery (using a jumper pack is much safer than jumper cables) and driving it to a place where you can place a REAL battery charger on the battery.
    1. This was much more of an issue a generation ago, when your ‘74 Chevy Nova or ‘69 Ford F-100 had a 35 amp alternator. Any car made in the last 15-20 years will have a 75 amp alternator as a bare minimum, and ratings well north of 100 amps are common in larger vehicles.There’s dozens of amps of headroom to charge the battery at idle speed, especially if you turn off the lights, stereo, HVAC, etc. That said, it’ll charge even more quickly if you drive the car.

      In reply to: https://hyp.is/YNQwwlF0Ee206UcS3HYLnA/www.reddit.com/r/Cartalk/comments/aoks7b/how_much_idling_needed_after_jump_start_to/

      This seems like more sound/trustworthy advice than the replied-to's advice/info.

    2. This will KILL your alternator. You should get a battery charger or a trickle charger. Alternators go through hell when trying to recharge a fully depleted battery.
  4. Sep 2022
    1. in my personal opinion, there shouldn't be a special treatment of do-end blocks in general. I believe that anything that starts a "block", i.e. something that is terminated by and end, should have the same indentation logic
    1. Consumers can use the status member to determine what the original status code used by the generator was, in cases where it has been changed (e.g., by an intermediary or cache), and when message bodies persist without HTTP information. Generic HTTP software will still use the HTTP status code.
    1. https://www.amazon.com/s?k=math+demystified&i=stripbooks&crid=UM15P2ZTY84C&sprefix=math+demystified%2Cstripbooks%2C137&ref=nb_sb_noss_2

      A whole series of books from McGraw Hill whose titles all carry an implicit math shaming. Who wants to carry these books around and be seen reading them? Even the word DeMYSTiFieD on the cover is written in CLoWn case.

      • Business Math Demystified
      • Dosage Calculations and Basic Math for Nurses Demystified
      • Geometry Demystified
      • Business Calculus Demystified
      • Math Word Problems Demystified
      • Everyday Math Demystified
      • Discrete Mathematics Demystified
      • Math Proofs Demystified
      • Pre-Algebra Demystified
  5. Aug 2022
    1. It seems to me that they tried to roboticize a manufacturing process for a product that was designed to be manufactured by humans. Rookie mistake.

      If they want to automate construction of Mac products, they'll have to redesign the product to fit the constraints of robotic manufacture.

    1. Dr Dan Goyal. (2022, March 15). What’s been happening This Week in Covid? The schism between reality and policy grew even wider this week... Omicron B.2 sent cases soaring and stock markets sinking! #TheWeekInCovid [Tweet]. @danielgoyal. https://twitter.com/danielgoyal/status/1503699425427968001

    1. ReconfigBehSci. (2021, December 13). RT @DrEricDing: 11) Omicron is doubling every 1.6 days in UK 🇬🇧 according to @DrWilliamKu’s figure. That’s way faster growth than in South… [Tweet]. @SciBeh. https://twitter.com/SciBeh/status/1470451594378502154

    1. John Burn-Murdoch. (2021, November 25). Five quick tweets on the new variant B.1.1.529 Caveat first: Data here is very preliminary, so everything could change. Nonetheless, better safe than sorry. 1) Based on the data we have, this variant is out-competing others far faster than Beta and even Delta did 🚩🚩 https://t.co/R2Ac4e4N6s [Tweet]. @jburnmurdoch. https://twitter.com/jburnmurdoch/status/1463956686075580421

    1. ReconfigBehSci. (2021, December 9). a rather worrying development- a (local) newspaper “fact checking” the new German health minister simply by interviewing a virologist who happens to have a different view. There’s simply no established “fact” as to the severity of omicron in children at this point in time [Tweet]. @SciBeh. https://twitter.com/SciBeh/status/1469037817481334786

    1. The instructions here for "Postman Collection" might be useful on the portal, but are they too complex? Is there anything we can do (such as purchase a Postman team license) to streamline this part of the work? Ask the ProServ Team.

    1. Beyond memory leaks, it's also really useful to be able to re-run a test many times to help with tracking down intermittence failure and race conditions.
    1. It's a great way to test various limits. When you think about this even more, it's a little mind-bending, as we're trying to impose a global clock ("who is the most up to date") on a system that inherently doesn't have a global clock. When we scale time down to nanoseconds, this affects us in the real world of today: a light-nanosecond is not very far.
    2. Which of these to use depends on the result you want. Note that by the time you get the answer, it may be incorrect (out of date). There is no way to fix this locally. Using some ESP,2 imagine the remote you're contacting is in orbit around Saturn. It takes light about 8 minutes to travel from the sun to Earth, and about 80 to travel from the sun to Saturn, so depending on where we are orbitally, they're 72 to 88 minutes away. Any answer you get back from them will necessarily be over an hour out of date.
    3. When we have our git rev-parse examine our Git repository to view our origin/HEAD, what we see is whatever we have stored in this origin/HEAD. That need not match what is in their HEAD at this time. It might match! It might not.
    4. Exaggeration of System Parameters
  6. Jun 2022
  7. May 2022
    1. The shared context worked though thanks! RSpec.shared_context "perform_enqueued_jobs" do around(:each) { |example| perform_enqueued_jobs { example.run } } end RSpec.configure do |config| config.include_context "perform_enqueued_jobs" end

      use case for around

    1. 1/ It fits into existing spec based testing infrastructure nicely, including running on travis, code coverage using SimpleCov, switching between generating a profile (RubyProf), a benchmark (Benchmark::IPS) or normal test run. 2/ Some of my benchmarks do have expect clauses to validate that things are working before invoking the benchmark.

      Answering the question:

      I don't understand the point of putting it in a spec. What does that gain you over using benchmark-ips the normal way?

    2. I just wanted to mention there was, IMHO, a valid use case for this. It helps add to the validity of the ticket and the design of the feature.
    1. DICER1 syndrome is an autosomal-dominant,pleiotropic, tumor-predisposition disorder arisingfrom pathogenic germline variants in DICER1, whichencodes an endoribonuclease integral to processingmicroRNAs

      DICER1 is the gene name. PubMed ID, HGCNCID, and Variant: I can't find Inheritance Pattern: autosomal-dominant The disease entity: DICER1 syndrome The type of mutation: germline. Zygosity: not known. Family Information: a family was used, DICER1 carriers, and non DICER1 variant used, some of the family members had tumors from DICER1 Case Information: mean age is 34, the range of age is 18.6 to 43 years, male, and female used, ethnicity can't find Case Presenting HPO: cancer testing, chemotherapy, radiotherapy gnomeAD: 9.2,8.3.2 Mutation type: Pleiotropic, loss of function, missense

  8. Apr 2022
    1. They coincide in most cases, but they don't if there are series of consecutive uppercase letters as in "HTMLParser"
    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. There are project layouts that put implementation files and test files together.
    3. Let's suppose that your gem decorates something in Kernel:
    1. if Rails.application.config.reloading_enabled? Rails.autoloaders.main.on_unload("Country") do |klass, _abspath| klass.expire_redis_cache end end
    2. If your application decorates classes or modules from an engine,
    3. Some projects want something like app/api/base.rb to define API::Base, and add app to the autoload paths to accomplish that.
    4. By default, app/models/concerns belongs to the autoload paths and therefore it is assumed to be a root directory. So, by default, app/models/concerns/foo.rb should define Foo, not Concerns::Foo.
    1. To drive this point home:

      I sometimes get people who balk at my characterization of GitHub-style anti-wikis as being inferior to, you know, actual wikis. "You can just use the GitHub UI to edit the files", they'll sometimes say.

      A case study: a couple days ago, I noticed that the lone link in the current README for Jeff Zucker's solid-rest project is a 404. I made a note of it. Just now, I reset my GitLab password, logged in to solid/chat, and notified Jeff https://gitter.im/solid/chat?at=611976c009a1c273827b3bd1. Jeff's response was, "I'll change it".

      This case is rich with examples of what makes unwikis so goddamn inefficient to work with. First, my thought upon finding the broken link was to take note of it (i.e. so that it can eventually be taken care of) rather than fixing it immediately, as would have been the case with a wiki. More on this in a bit. Secondly, my eventual action was still not something that directly addressed the problem—it was to notify someone else† of the problem so that it might be fixed by them, due to the unwiki nature of piles of Git-managed markdown. Thirdly, even Jeff's reflex is not to immediately change it—much like my reaction, his is to note the need for a fix himself and then to tell me he's going to change it, which he will presumably eventually do. Tons of rigamarole just to get a link fixed‡ that remains broken even after having gone through all this.

      † Any attempt to point the finger at me here (i.e. coming up short from having taken the wrong action—notifying somebody rather than doing it myself) would be getting it wrong. First, the fact that I can't just make an edit without taking into account the myriad privacy issues that GitHub presents is materially relevant! Secondly, even if I had been willing to ignore that thorn (or jump through the necessary hoops to work around it) and had used the GitHub web UI as prescribed, it still would have ended up as a request for someone else to actually take action on, because I don't control the project.

      ‡ Any attempt to quibble here that I'm talking about changing a README and not (what GitHub considers) a wiki page gets it wrong. We're here precisely because GitHub's unwikis are a bunch of files of markdown. The experience of changing an unwiki page would be rife with the same problems as encountered here.

    1. 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:
    2. 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. You want the front page to show a few hundred posts along with the top three comments on each post. You’re planning on being very popular, so the front page will need to be very fast. How do you fetch that data efficiently from postgresql using Activerecord?
    2. 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. Let's say the user is in the process of selecting some files. The names don't indicate anything. So she has to listen and select.
    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.
  9. Mar 2022
    1. This has cropped up in particular when trying to create a copy of a store object when the store changes (which is a common use case with forms where you don't want to mutate the global store until the form is saved).

      Exactly! This is more or less the same kind of use case I tend to have: intentionally having/wanting a stale/out-of-date copy of a (reactive) object.

    1. This is particularly useful in cases where you want to separate your data migrations from your schema migrations or where you have multiple steps in your migration process that must have other steps invoked throughout.
    1. If you need to ensure migrations run in a certain order with regular db:migrate, set up Outrigger.ordered. It can be a hash or a proc that takes a tag; either way it needs to return a sortable value: Outrigger.ordered = { predeploy: -1, postdeploy: 1 } This will run predeploys, untagged migrations (implicitly 0), and then postdeploy migrations.
    2. class PreDeployMigration < ActiveRecord::Migration tag :predeploy end
    3. This is especially useful for zero downtime deploys to Production environments.
  10. Feb 2022
    1. This is especially useful for UI library components, as it is generally unknown which events will be required from them for all desired use cases. For example, if a Button component only forwards a click event, then no use case that requires the mouseover or the keypress event can be used with it.