Hacker News new | past | comments | ask | show | jobs | submit | 0xml's comments login

Firefox expects your script to return undefined, so you can add one at the end (or even shorter: void 0).


Thank you (and neighbors), I didn't know this.


To clarify slightly, bookmarklet behavior across browsers is to call `document.write` with the result of the bookmarklet’s last expression unless that result is `undefined`, and calling `document.write` after page load completes replaces the page’s DOM with the content written. It’s a weird bookmarklet thing, I don’t think there’s anywhere else in JS that accepts a list of statements, not expressions, but cares about the result of the last expression.

People often disable this by making the last expression `void 0`, which evaluates to `undefined`. This is really an anachronism, though, the original point wasn’t actually brevity (it’s only one character shorter after URL encoding, not worth funky syntax) but that just writing `undefined` was broken and sometimes didn’t evaluate to the special value undefined. That’s fixed now, so I would just append `undefined` instead.

Though, really what you should do is always wrap bookmarklets in IIFEs, which avoids stomping around the page’s global variables, lets you write code with early exits, lets you opt back in with an explicit return rather than editing boilerplate, and also solves this issue as a bonus.


Another interesting method is Fibonacci Lattice. https://observablehq.com/@meetamit/fibonacci-lattices


This is a feature of arxiv that automatically converts text looks like a link into "this http url". The submitter missed the space after the "." in "...strong reasoning ability. OpenAI has claimed...".

https://info.arxiv.org/help/prep.html#abstract-required


Related: Bypassing Bitlocker using a cheap logic analyzer on a Lenovo laptop https://news.ycombinator.com/item?id=37249623


pi^4+pi^5=e^6 lol


Wang Duoyu (王多鱼) is a character in the Chinese comedy film Hello Mr. Billionaire.

https://www.imdb.com/title/tt8529186/


I remember chrome has a flag for this.


Let x=1/d, then compute the Taylor series at x=0 and take the first 2 or 3 terms. It should be accurate and fast enough.


That's why I kind of like PowerShell, object-oriented instead of string-oriented


I get what you’re saying but the other weird limitations of powershell as well as microsoft’s strangely abusive security relationship with powershell makes it a non-starter for me, or at least makes me hesitate a ton before putting effort into a ps script since even in the same AD orgs which in theory have the same gpos applied across all machines, it’s a crapshoot if the ps script will even execute without having to trick windows into allowing it to run. object oriented nature of ps is also a curse as much as blessing as simple text parsing or iterating over files on a system are very slow compared to bash, never minding that from my experience it’s a crapshoot on how well a given ps module handles strings and how that will be reflected in the script.

(e.g., one company’s ps module doesn’t handle square brackets ][ well and for an inexplicable reason the normal ps escaping does not work as advertised, requiring more backticks than usual and a different number depending on if you “” or ‘’ the input string. As best i can tell its joint fault of ps bug and poor module design but had no luck convincing the vendor to adjust their design because “it will break existing scripts”, which is a valid concern but it also means writing automation for their product is a headache since you’re going to see ][ in production environments as is a visually obvious delimiter when humans are reading it)


It seems like a good idea but breaks down, a shell is text for good reasons.

Psh is ok in Windows land on Microsoft tools, but IMO you might as well use Python if you want those features. I run the same bash script on five platforms while the power of bash disappears when you do not have all the 3rd party tools and Unix kernel, it is still easy to write and execute fast.

That said the idea of power shell is great I use it from bash on Windows for very limited things. As a shell to integrate stuff not so much.


POSIX Shell is text for good reasons, but file names aren't (necessarily) text. So POSIX shells aren't very well-suited to dealing with file names, requiring arcane hackery to be portable & safe. It'd be easier with any sort of type system to distinguish file names from text, object orientation isn't necessary at all.


After using powershell for a while, I just cannot get back into "unix" tools. Crazy shell syntax/parsing, inadequate formats...


It can be written as one rule: `body,img,video{...}`.


Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: