10,000 Matching Annotations
  1. Nov 2021
    1. Regarding mapped types, remember that { [K in T]: U } is a special form - it can't be combined with other properties within the { }. So there's not really a name for the [K in T: U] part because it's just part of the overall "mapped type" syntax { [K in T]: U }
    2. I thought I knew how they worked, but it looks I was wrong and made two false assumptions: Thought that typeof of object literals are inferred to have (string | number) index signature Thought that mapped types over union of string literals is a way to declare a limited set of string index signatures That's how it looked to me from the example in Typescript Deep Dive
    1. Like others have noted, your function does not conform to index signature. [key: string]: string means "all fields are strings" and on the next line you declare a field with function in it.This can be solved by using union types:type IFoo = { [foo: string]: string } & { fooMethod(fooParam: string): void }
    1. This PR adds a new top type unknown which is the type-safe counterpart of any. Anything is assignable to unknown, but unknown isn't assignable to anything but itself and any without a type assertion or a control flow based narrowing. Likewise, no operations are permitted on an unknown without first asserting or narrowing to a more specific type.
    1. Seems related, currently there's no way to enforce that object should have attribute values of specific type only. Example: I want to define an abstract Table Row, basically any object limited to attribute values as primitive types. But it doesn't work // Table row export type Row = Record<string, string | number | undefined> // User interface User { name: string } const jim: User = { name: 'Jim' } const row: Row = jim // <== Error
    1. So now the question is, why does Session, an interface, not get implicit index signatures while SessionType, an identically-structured typealias, *does*? Surely, you might again think, the compiler does not simply deny implicit index signatures tointerface` types? Surprisingly enough, this is exactly what happens. See microsoft/TypeScript#15300, specifically this comment: Just to fill people in, this behavior is currently by design. Because interfaces can be augmented by additional declarations but type aliases can't, it's "safer" (heavy quotes on that one) to infer an implicit index signature for type aliases than for interfaces. But we'll consider doing it for interfaces as well if that seems to make sense And there you go. You cannot use a Session in place of a WithAdditionalParams<Session> because it's possible that someone might merge properties that conflict with the index signature at some later date. Whether or not that is a compelling reason is up for rather vigorous debate, as you can see if you read through microsoft/TypeScript#15300.
    2. why is Session not assignable to WithAdditionalParams<Session>? Well, the type WithAdditionalParams<Session> is a subtype of Session with includes a string index signature whose properties are of type unknown. (This is what Record<string, unknown> means.) Since Session does not have an index signature, the compiler does not consider WithAdditionalParams<Session> assignable to Session.
  2. Oct 2021
    1. However, this way of thinking about the built-in sameness operators is not a model that can be stretched to allow a place for ES2015's Object.is on this "spectrum". Object.is isn't "looser" than double equals or "stricter" than triple equals, nor does it fit somewhere in between (i.e., being both stricter than double equals, but looser than triple equals). We can see from the sameness comparisons table below that this is due to the way that Object.is handles NaN. Notice that if Object.is(NaN, NaN) evaluated to false, we could say that it fits on the loose/strict spectrum as an even stricter form of triple equals, one that distinguishes between -0 and +0. The NaN handling means this is untrue, however. Unfortunately, Object.is has to be thought of in terms of its specific characteristics, rather than its looseness or strictness with regard to the equality operators.
    1. The issue seems to be that when there are multiple layouts configured, VS Code sets as key layout the first value for layout form setxkbmap -query, ignoring the current layout. If I switch to be en,de then VS Code uses the EN layout, as it is the first in the list. It would be handy if VS Code could use the current layout instead of the first from the list.
    1. To do that, Chrome automatically links your Chrome profile to a Google account when you sign in to any Google service on the web. That helps Google deliver a ‘seamless experience’ across all devices by letting you sync your history, bookmarks, passwords, etc., across multiple devices. Meanwhile, privacy-conscious users see this as a major threat to their online privacy and advise users to remove their Google account from Chrome.
    1. Some Chrome users may like the new functionality as it makes it easier for them to sign in or out of Chrome and Google on the Web. Others may dislike it for privacy and user-choice reasons. Think about it, if you sign in to Chrome you are automatically recognized by any Google property on the web as that Google user.
    1. I have all my bookmarks and settings attached to an account which is part of a Gsuite i'm not part of anymore, so i want to resync my chrome with my personal account, but I don't know how to import all the bookmarks and settings from the old Gsuite account to my personal one

      I can relate...

    1. let bookmarkList = Array.from(document.querySelectorAll('.widget>.vbox')) .map(e => e.shadowRoot) .map(e => e && e.querySelector('.device-page-list')) .find(e => e); let bookmarks = Array.from(bookmarkList.querySelectorAll('.vbox')) .map(e => `[${e.querySelector('.device-page-title').innerHTML}](${e.querySelector('x-link').innerHTML})`); copy(bookmarks.join('\n'));
    1. Having a large extension ecosystem is something that can help deal with the lack of certain capabilities, as third-party developers can create their own add-ons that others might find useful as well.

      can create your own

    1. Please note that gtk-launch requires the .desktop file to be installed (i.e. located in /usr/share/applications or $HOME/.local/share/applications). So to get around this, we can use a hackish little bash function that temporarily installs the desired .desktop file before launching it. The "correct" way to install a .desktop file is via desktop-file-install but I'm going to ignore that.
    1. They are on client-side, but (usually) they are HTTPOnly. Now if they are part of session, any client-side script is able to access them, and I just don't like introducing vulnerabilities knowingly. As I said above, I found a workaround that works for me and you may have different opinion from me on how much this is a risk.
    1. This function allows you to modify (or replace) a fetch request for an external resource that happens inside a load function that runs on the server (or during pre-rendering). For example, your load function might make a request to a public URL like https://api.yourapp.com when the user performs a client-side navigation to the respective page, but during SSR it might make sense to hit the API directly (bypassing whatever proxies and load balancers sit between it and the public internet).
    1. Collapsing directories Say some directories in a project exist for organizational purposes only, and you prefer not to have them as namespaces. For example, the actions subdirectory in the next example is not meant to represent a namespace, it is there only to group all actions related to bookings: booking.rb -> Booking booking/actions/create.rb -> Booking::Create
    1. Inflections go the other way around.In classic mode, given a missing constant Rails underscores its name and performs a file lookup. On the other hand, zeitwerk mode checks first the file system, and camelizes file names to know the constant those files are expected to define.While in common names these operations match, if acronyms or custom inflection rules are configured, they may not. For example, by default "HTMLParser".underscore is "html_parser", and "html_parser".camelize is "HtmlParser".
    2. Applications can safely autoload constants during boot using a reloader callback: Rails.application.reloader.to_prepare do $PAYMENT_GATEWAY = Rails.env.production? ? RealGateway : MockedGateway end Rails.application.reloader.to_prepare do $PAYMENT_GATEWAY = Rails.env.production? ? RealGateway : MockedGateway end Copy That block runs when the application boots, and every time code is reloaded.

      workaround to problem described earlier

    1. export interface QueueInterface {   count(): number;   dequeue?(): any;   enqueue(...args: any): void;   flush(): any[];   reset(): void;   setFifo(fifo: boolean): void;   setLifo(lifo: boolean): void;   truncate(length: number): void; } export class queue {   protected elements: any[];   protected fifo = true;   constructor(…args: any) {     this.elements = […args];   }   count() {     return this.elements.length;   }   dequeue?(): any {     if (this.fifo) {       return this.elements.shift();     }     return this.elements.pop();   }   enqueue(…args: any) {     return this.elements.push(…args);   }   // Like dequeue but will flush all queued elements   flush(): any[] {     let elms = [];     while (this.count()) {       elms.push(this.dequeue());     }     return elms;   }   setFifo(fifo = true) {     this.fifo = fifo;   }   setLifo(lifo = true) {     this.fifo = !lifo;   }   reset(): void {     this.truncate(0);   }   truncate(length: number) {     if (Number.isInteger(length) && length > -1) {       this.elements.length = length;     }   } } export default queue;
    2. For me however, things get really interesting with the creation of “custom” stores. The creators of Svelte were/are obviously well aware of the power and flexibility of these stores and have provided a simply interface to adhere to. Basically, any object that implements the “subscribe” method is a store!
    1. And on any given day, developing with Svelte and its reactive nature is simply a dream to use. You can tell Svelte to track state changes on practically anything using the $: directive. And it’s quite likely that your first reactive changes will produce all the expected UI results. But as you start to rely more on UI updates based on variable or array/object changes, it’s likely that your UI will start skipping a beat and dropping values that you know explicitly to be there.
    1. TylerRick - HypothesisYour browser indicates if you've visited this linkhttps://hypothes.is › users › TylerRick

      finding my own content in search results

    1. If you still have problems, please open a ticket and let us know: Your order number The key you're having trouble activating (please tell us exactly what you're entering) The message displayed by Steam That you've already tried logging out and back into Steam and then still couldn't activate the key.

      .

  3. Sep 2021
    1. The Code Expressly prohibits glueing dissimilar plastics together: Listed under "Prohibited Joints" "No glue joints between different tyes of plastic" REF: International Residential Code 2904.16.2 Uniform Plumbing Code 316.1.6 It is true that Oatey makes a glue that is listed as approved for both ABS & PVC however there still remains a good reason why it is not approved for glueing dissimilar types of plastics together. In a normal glueing situation the bonding material sticks to the surface of both pieces being fastened together, thus forming a bond, but such is not the case with plastic plumbing pipe and fittings. When connecting plastic plumbing fittings we must first use a solvent type cleaner/primer. While the cleaner primer does clean the fitting, its primary purpose is to soften or break the smooth glazed surface of the pipe which exposes the inner polimers. The glue then chemically softens the plastic on both the pipe wall and the fitting interior and the two surfaces then fuse together forming a chemical weld. The problem with attempting to glue dissimilar plastic is that they do not react to the glue at the same rate, therefore one material may soften and reharden again before the other surface has softened sufficiently to fuse a true weld. The end result is that while it has all the appearances of having glued together you are left with a weak joint, in the same manner as a cold solder joint.
    1. Anyone here should know it is of extraordinary importance to maintain trap (water) seals. The gas in the downstream is full of methane, odorless and colorless, and it will cause heart and lung problems if let loose inside and lived with. That should be written on the sky.
    1. Still not clear what this daemon does...

      And when you say switch display between HiDPI and LoDPI, what does that do? If it's a high-DPI display, does it emulate a low-DPI experience, for example by scaling/zooming / using 2 output pixels for every 1 in the input picture.

      Is this the same as the fractional scaling feature?

      The GUI for it:

      • lets me enable/disable (what happens if I disable?)
      • Change Mode: "Enable to render LoDPI displays at HiDPI resolution". What does that mean?

      I tried disabling both of those options but

      1. hidpi-daemon was still running
      2. I noticed no visible change

      So I just killed the process. Again, no visible change. So again, what does this daemon actually do for me? What is the benefit of having it running? (I'm not the only one wondering: https://www.reddit.com/r/pop_os/comments/lwsf4a/hidpi_daemon/ , https://www.reddit.com/r/pop_os/comments/lxpfpl/hidpidaemon_was_a_huge_battery_drain_for_me_had/ )

    2. We also made it simple to switch displays between HiDPI and LoDPI.  This is especially useful for applications like GIMP and Inkscape whose toolkits do not support HiDPI and appear very small in HiDPI screens.

      .

    1. Commenting on a recent case from the Washington State Court of Appeals, it says that the outcome “signals a strong return to the legal principle of caveat emptor – otherwise known as ‘buyer beware’.” This ruling is interpreted to mean that “the seller may now intentionally conceal a defect and lie about it, and as long as the buyer’s inspector has some indication of a potential problem and the buyer fails to investigate further, the seller will survive a lawsuit.”
    1. gsettings set org.gnome.desktop.wm.keybindings move-to-center "['<Control><Super>c']" gsettings set org.gnome.desktop.wm.keybindings move-to-side-e "['<Control><Super>Right']" gsettings set org.gnome.desktop.wm.keybindings move-to-side-n "['<Control><Super>Up']" gsettings set org.gnome.desktop.wm.keybindings move-to-side-s "['<Control><Super>Down']" gsettings set org.gnome.desktop.wm.keybindings move-to-side-w "['<Control><Super>Left']"
    1. You can choose the displayed language by adding a language suffix to the web address so it ends with e.g. .html.en or .html.de. If the web address has no language suffix, the preferred language specified in your web browser's settings is used. For your convenience: [ Change to English Language | Change to Browser's Preferred Language ]
    1. The key to a functional island fixture vent is that the top elbow must be at least as high as the "flood level" (the peak possible drain water level in the sink). This is to ensure that the vent does not become a de facto drain should the actual drain get clogged.
    1. The browser (on PC operating systems) always has a choice to not use the system-provided mechanisms in the first place. It can send its own UDP packets or make TCP connections.
      • always has a choice
      • bypassing defaults
    1. Therefore, Firefox already contains the code to look in the hosts file, but it does things in the wrong order: 1. Look up the URL in the DNS server if not found: 2. Send the URL to the default search engine as a search term if not found: 3. Look in the hosts file

      incorrect behavior

    2. The entries in the hosts file are obviously not on a DNS server. Setting the keyword.enabled option FALSE by itself should only turn off the feature that uses the address field as a search field. It would not give Firefox an additional ability that it did not have before.
    1. This is more secure than simply opening up your server’s firewall to allow connections to port 5901, as that would allow anyone to access your server over VNC. By connecting over an SSH tunnel, you’re limiting VNC access to machines that already have SSH access to the server.