Write a polite but firm email to a landlord who has not fixed the heating for three weeks. I want the repair, not a fight.
Claude Opus 5.5
Subject: Heating Repair Needed at [Your Address] – Request for Repair Date
Dear [Landlord's Name],
I'm writing about the heating at [your address, unit number], which has not been working since [date the problem started]. I first reported it on [date of first report] and followed up on [date(s) of later contact], but it has now been about three weeks without a repair.
I appreciate that things can get busy. However, with the current temperatures, the flat is getting very cold, and it is becoming difficult to live in comfortably. [Optional: add a specific detail, e.g., "The indoor temperature has been dropping to around X°C/°F overnight," or "This is especially difficult because I work from home / have a young child."]
Could you please confirm by [specific date, e.g., Friday, March 8] when a repair technician will come? I'm happy to be flexible with access. I'm generally available [list days/times], and I can arrange access at other times if needed.
If there is anything you need from me to help move this forward, such as photos, a description of the problem, or a contact number for the technician, please let me know and I'll send it straight away.
Thank you for your help. I'd like to get this resolved quickly and smoothly for both of us.
Kind regards, [Your Name] [Your Phone Number] [Your Address / Unit Number]
A few tips to help you get results without creating conflict:
Send it in writing (email or letter) so you have a dated record, even if you've only called before.
Keep copies of all messages and note the dates of any calls.
If you get no reply by your deadline, send a short, calm follow-up. You could add a line such as: "I understand landlords are generally required to keep heating in working order, so I'd be grateful if we could arrange this as soon as possible." This reminds them of their obligation without sounding like a threat.
If it still isn't fixed, check your local tenant rights. Most areas have a housing authority or tenant advice service that can help.
Asked Nov 1, 2026. Unedited.
Gemini 4 Argon
Here is a polite, professional, and firm email template. It avoids threatening language while clearly stating that the wait time has become unacceptable and requires immediate action.
Subject: URGENT: Heating repair follow-up – [Your Apartment/Unit Number]
Dear [Landlord's Name],
I hope you are having a good week.
I am writing to follow up on my previous messages from [Date of first request] regarding the broken heating in my unit. As it has now been three weeks without heat, the apartment is becoming increasingly uncomfortable to live in, especially as the temperatures drop.
I understand that scheduling contractors and sourcing parts can sometimes cause delays, and I appreciate your efforts so far. However, because working heat is an essential service, we really need to get this resolved as soon as possible.
Could you please provide me with a firm date and time for when a technician will be here to complete the repair?
If your usual HVAC technician is backed up, I would be more than happy to help coordinate with an alternate local company to get someone out here this week. Additionally, if the repair cannot be completed within the next 48 hours, could you please provide space heaters for the unit in the meantime?
Thank you for your prompt attention to this matter. I look forward to hearing from you by the end of the day tomorrow so we can get this scheduled.
Best regards,
[Your Name] [Your Apartment/Unit Number] [Your Phone Number]
Why this works:
Creates a paper trail: Mentioning the exact date you first reported the issue subtly reminds them of their legal obligation to make timely repairs without sounding like a lawyer.
Offers solutions, not just complaints: Offering to coordinate with a different repair company removes their excuse of "my usual guy is busy."
Asks for temporary relief: Asking for space heaters signals that the unit is currently uninhabitable, while giving them an immediate, easy way to help you.
Sets a deadline for a response: Asking to hear back "by the end of the day tomorrow" creates urgency and prevents them from putting your email on the back burner again.
Asked Nov 1, 2026. Unedited.
Write a React hook that debounces a value and cancels on unmount. Include the TypeScript types.
Claude Opus 5.5
useDebouncedValue and useDebouncedCallback
Below are two hooks:
useDebouncedValue: debounces a value. This is what you asked for.useDebouncedCallback: debounces a function, withcancelandflushcontrols. It's useful when you need to debounce an event handler rather than state.
Both cancel any pending timer when the component unmounts, so no state update or callback runs after unmount.
1. useDebouncedValue
// useDebouncedValue.ts
import { useEffect, useState } from 'react';
/**
* Returns `value` after it has stopped changing for `delay` ms.
* Any pending update is cancelled when `value` or `delay` changes,
* or when the component unmounts.
*/
export function useDebouncedValue<T>(value: T, delay: number = 300): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);
useEffect(() => {
const timeoutId: ReturnType<typeof setTimeout> = setTimeout(() => {
setDebouncedValue(value);
}, delay);
// Runs before the next effect (value/delay changed) AND on unmount.
return () => {
clearTimeout(timeoutId);
};
}, [value, delay]);
return debouncedValue;
}Usage
import { useEffect, useState } from 'react';
import { useDebouncedValue } from './useDebouncedValue';
interface User {
id: string;
name: string;
}
export function UserSearch() {
const [query, setQuery] = useState<string>('');
const [results, setResults] = useState<User[]>([]);
const debouncedQuery = useDebouncedValue(query, 400);
useEffect(() => {
if (!debouncedQuery) {
setResults([]);
return;
}
const controller = new AbortController();
fetch(`/api/users?q=${encodeURIComponent(debouncedQuery)}`, {
signal: controller.signal,
})
.then((res) => res.json() as Promise<User[]>)
.then(setResults)
.catch((err: unknown) => {
if ((err as Error).name !== 'AbortError') console.error(err);
});
return () => controller.abort(); // cancel in-flight request too
}, [debouncedQuery]);
return (
<>
<input value={query} onChange={(e) => setQuery(e.target.value)} />
<ul>
{results.map((u) => (
<li key={u.id}>{u.name}</li>
))}
</ul>
</>
);
}2. useDebouncedCallback (with cancel / flush)
// useDebouncedCallback.ts
import { useEffect, useLayoutEffect, useMemo, useRef } from 'react';
export interface DebouncedFunction<Args extends unknown[]> {
(...args: Args): void;
/** Cancel any pending invocation. */
cancel: () => void;
/** Immediately invoke the pending call, if any. */
flush: () => void;
/** Whether a call is currently scheduled. */
isPending: () => boolean;
}
// useLayoutEffect warns during SSR; fall back to useEffect on the server.
const useIsomorphicLayoutEffect =
typeof window !== 'undefined' ? useLayoutEffect : useEffect;
export function useDebouncedCallback<Args extends unknown[]>(
callback: (...args: Args) => void,
delay: number = 300
): DebouncedFunction<Args> {
const callbackRef = useRef(callback);
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const pendingArgsRef = useRef<Args | null>(null);
// Always call the latest callback without resetting the debounce timer.
useIsomorphicLayoutEffect(() => {
callbackRef.current = callback;
}, [callback]);
const debounced = useMemo<DebouncedFunction<Args>>(() => {
const invoke = (): void => {
const args = pendingArgsRef.current;
timeoutRef.current = null;
pendingArgsRef.current = null;
if (args) callbackRef.current(...args);
};
const cancel = (): void => {
if (timeoutRef.current !== null) {
clearTimeout(timeoutRef.current);
timeoutRef.current = null;
}
pendingArgsRef.current = null;
};
const fn = ((...args: Args): void => {
pendingArgsRef.current = args;
if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
timeoutRef.current = setTimeout(invoke, delay);
}) as DebouncedFunction<Args>;
fn.cancel = cancel;
fn.flush = () => {
if (timeoutRef.current !== null) {
clearTimeout(timeoutRef.current);
invoke();
}
};
fn.isPending = () => timeoutRef.current !== null;
return fn;
}, [delay]);
// Cancel on unmount (and when `delay` changes, which creates a new function).
useEffect(() => {
return () => debounced.cancel();
}, [debounced]);
return debounced;
}Usage
import { useDebouncedCallback } from './useDebouncedCallback';
export function AutoSaveEditor({ docId }: { docId: string }) {
const save = useDebouncedCallback((content: string) => {
void fetch(`/api/docs/${docId}`, {
method: 'PUT',
body: JSON.stringify({ content }),
});
}, 1000);
return (
<textarea
onChange={(e) => save(e.target.value)} // typed: (content: string) => void
onBlur={() => save.flush()} // save immediately when leaving
/>
);
}Notes
ReturnType<typeof setTimeout>keeps the timer type correct in both browser (number) and Node (Timeout) environments.Cancellation on unmount comes from the effect cleanup functions. React calls them on unmount, so
clearTimeoutstops any pendingsetStateor callback.Stable callback identity:
useDebouncedCallbackstores the latestcallbackin a ref. Passing an inline arrow function therefore doesn't reset the timer on every render. The returned function only changes whendelaychanges.StrictMode double-mounts effects in development. Both hooks handle this correctly because cleanup clears the timer before the effect runs again.
Asked Nov 1, 2026. Unedited.
Gemini 4 Argon
Here is a clean, generic useDebounce hook written in TypeScript. It automatically handles canceling the timeout both when the value/delay changes and when the component unmounts.
useDebounce.ts
import { useState, useEffect } from 'react';
/**
* Custom hook that debounces a value.
*
* @param value The value to debounce.
* @param delay The delay in milliseconds.
* @returns The debounced value.
*/
export function useDebounce<T>(value: T, delay: number): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);
useEffect(() => {
// Set a timeout to update the debounced value after the specified delay
const timer = setTimeout(() => {
setDebouncedValue(value);
}, delay);
// Cleanup function: cancels the timeout if the value or delay changes
// before the timeout completes, OR if the component unmounts.
return () => {
clearTimeout(timer);
};
}, [value, delay]);
return debouncedValue;
}Example Usage
Here is how you can use it in a component (e.g., waiting for a user to stop typing before making an API call):
import React, { useState, useEffect } from 'react';
import { useDebounce } from './useDebounce';
export const SearchComponent: React.FC = () => {
const [searchTerm, setSearchTerm] = useState<string>('');
// Debounce the search term so it only updates 500ms after the user stops typing
const debouncedSearchTerm = useDebounce<string>(searchTerm, 500);
useEffect(() => {
if (debouncedSearchTerm) {
console.log(`Fetching API results for: ${debouncedSearchTerm}`);
// Perform your API call here
}
}, [debouncedSearchTerm]);
return (
<input
type="text"
placeholder="Search..."
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
);
};Key Features:
Generics (
<T>): It preserves the exact TypeScript type of whatever value you pass into it (strings, numbers, objects, arrays, etc.).Unmount Safety: Because
clearTimeoutis returned in theuseEffectcleanup function, React guarantees it will run if the component unmounts, preventing memory leaks and "state update on an unmounted component" warnings.
Asked Nov 1, 2026. Unedited.
A drug test is 99% accurate, and 0.5% of people use the drug. Someone tests positive. What is the probability they use it, and why does the answer surprise people?
Claude Opus 5.5
About 33%, or roughly 1 in 3
This assumes "99% accurate" means the test correctly flags 99% of users (sensitivity) and correctly clears 99% of non-users (specificity).
The calculation (Bayes' theorem)
$$ P(\text{user} \mid +) = \frac{P(+ \mid \text{user})\,P(\text{user})}{P(+ \mid \text{user})\,P(\text{user}) + P(+ \mid \text{non-user})\,P(\text{non-user})} $$
$$ = \frac{0.99 \times 0.005}{0.99 \times 0.005 + 0.01 \times 0.995} = \frac{0.00495}{0.0149} \approx 0.332 $$
The intuitive version: imagine 10,000 people
| Test positive | Test negative | Total | |
|---|---|---|---|
| Users (0.5%) | ~50 (99% of 50) | ~0.5 | 50 |
| Non-users (99.5%) | ~100 (1% of 9,950) | ~9,850 | 9,950 |
| Total | ~150 | 10,000 |
Of about 150 positive results, only about 50 are real users. The other ~100 are false positives. So a positive result means roughly a 1 in 3 chance of actual drug use.
Why it surprises people
Base rate neglect. People focus on the vivid "99% accurate" figure and ignore how rare drug use is. When a condition is rare, even a small error rate applied to the huge non-user population produces more false positives than there are true positives.
Confusing the two conditional probabilities. The test tells you P(positive | user) = 99%. People instinctively treat that as P(user | positive). These are very different numbers. "Most users test positive" does not mean "most positives are users."
The 1% error feels negligible. But 1% of 9,950 non-users (~100 people) is double the entire user population (50 people).
Practical takeaway
This is why positive screening results are confirmed with a second, independent test. If someone tests positive twice, the probability jumps to about 98%, because the first positive raises the "base rate" from 0.5% to 33% before the second test is applied. The same logic applies to medical screening for rare diseases, fraud detection, and security screening.
Asked Nov 1, 2026. Unedited.
Gemini 4 Argon
The probability that the person actually uses the drug is 33.2% (or roughly 1 in 3).
This means that even with a 99% accurate test, a positive result is twice as likely to be a false alarm as it is to be a true positive.
Here is the breakdown of the math, followed by why our brains find this so hard to accept.
The Math (Made Simple)
While this is a classic application of Bayes' Theorem, it is much easier to understand using concrete numbers. Imagine we test a random population of 10,000 people.
1. Separate the users from the non-users:
Users: 0.5% of 10,000 = 50 people actually use the drug.
Non-Users: 99.5% of 10,000 = 9,950 people do not use the drug.
2. Test the 50 Users (True Positives):
The test is 99% accurate, so it catches 99% of the 50 users.
0.99 × 50 = 49.5 people test positive.
3. Test the 9,950 Non-Users (False Positives):
The test is 99% accurate, meaning it has a 1% failure rate. It will falsely accuse 1% of the innocent people.
0.01 × 9,950 = 99.5 people test positive.
4. Calculate the final probability:
In total, 149 people got a positive test result (49.5 true + 99.5 false).
Out of those 149 people, only 49.5 are actual drug users.
49.5 divided by 149 = 33.2%.
(Note: This assumes "99% accurate" means the test is 99% sensitive at catching users AND 99% specific at clearing non-users).
Why Does This Surprise People?
Most people intuitively guess the answer is 99%, or perhaps 98.5%. The real answer shocks people because of a well-documented psychological blind spot known as the Base Rate Fallacy (or Base Rate Neglect).
Here is why our intuition fails us:
1. We ignore the size of the pools When the human brain hears "99% accurate," it latches onto that number because it sounds like a near-certainty. Simultaneously, we ignore the "base rate" (the 0.5% of users). We forget that the 1% error rate is being applied to a massive group of non-users, while the 99% accuracy rate is being applied to a tiny group of actual users. 1% of a giant number is bigger than 99% of a tiny number.
2. We confuse the conditions People naturally confuse two very different probabilities:
The probability of testing positive if you use the drug (99%).
The probability of using the drug if you test positive (33.2%).
3. We are bad at dealing with percentages Evolutionary psychologists suggest that humans didn't evolve to understand percentages and probabilities; we evolved to understand tangible counts (like 3 out of 10 hunters). When the problem is framed as percentages (99%, 0.5%), almost everyone gets it wrong—including doctors and statisticians. When it is framed as frequencies (like the 10,000-person example above), the illusion disappears.
The Real-World Takeaway
This is why medical professionals and employers rarely rely on a single screening test for rare conditions or infrequent drug use. If someone tests positive on an initial screening, they are given a second, different test.
If that same person takes a second independent test and tests positive again, the "base rate" has now shifted from 0.5% to 33.2%, and the probability that they are a user skyrockets to 98%.
Asked Nov 1, 2026. Unedited.
Head to head
Ranked against 42 models, from public leaderboards and our own blind tests where we have them. How we rank
| Task | Claude Opus 5.5 | Gemini 4 Argon | Leads |
|---|---|---|---|
| Coding | #1 | #2 | Claude Opus 5.5 |
| Writing | #1 | #3 | Claude Opus 5.5 |
| Math | #1 | #2 | Claude Opus 5.5 |
| Research | #1 | #2 | Claude Opus 5.5 |
| Everyday chat | #1 | #2 | Claude Opus 5.5 |
The facts
Scores from artificialanalysis.ai and lmarena.ai.
| Fact | Claude Opus 5.5 | Gemini 4 Argon |
|---|---|---|
| Made by | Anthropic | |
| API price, per 1M tokens | $4 in, $20 out | $2 in, $10 out |
| Speed | 97 tokens a second | No public score |
| Artificial Analysis Index | 57.6 | No public score |
| LMArena text | 1,516 | No public score |
| LMArena coding | 1,545 | No public score |
| Updated | Oct 26, 2026 | |