cSpell:
cat package.json | jq -r '.devDependencies, .dependencies | keys_unsorted | map(gsub("@"; "")) | map(split("/")) | flatten | unique[]' > ./.vscode/packages.txt
// Define a trait function to that expects behavior to convert a value to type T | |
trait fun to<T>(): T | |
// So you want to require a property? Use a trait getter! | |
trait fun(get) displayName: String | |
// You can define a tuple type with parenthesis | |
tuple Name (String, String) { | |
|(first, last)| impl fun to<String>() = "${first} ${last}" | |
# latest supported electron version as of october 2024 | |
LATEST_SUPPORTED_VERSION=30 | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' # no color | |
mdfind "kind:app" 2>/dev/null | sort -u | while read app; | |
do | |
filename="$app/Contents/Frameworks/Electron Framework.framework/Electron Framework" | |
if [[ -f $filename ]]; then |
Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.
You use Next.js router like normally, but don't define getStaticProps
and such. Instead you do client-only fetching with swr
, react-query
, or similar methods.
You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)
Don't like Next? Here's how to do the same in Gatsby.
Notice that we’ve been using the term, fulfilled instead of resolved, and the reason is that a promise can be resolved to another promise and which point its fate becomes dependent on the other promise. If the other promise gets fulfilled our promise gets fulfilled, if the other promise is rejected, our promise gets rejected.
Both alpha and beta are resolved, but they settle to different fates. Alpha gets fulfilled, Beta gets rejected.
const delayFulfill =
() => new Promise(
res => setTimeout(() => res('fulfilled'), 1000)
);
This guide shows how to enable dev mode for the Discord desktop application running on Windows (as of February 2022).
This can be used to view beta experiments to try features currently in development that are included but hidden by default in Discord release builds.
It's come to my attention that some people have been spamming issue trackers with a link to this gist. While it's a good idea to inform people of the situation in principle, please do not do this. By all means spread the word in the communities that you are a part of, after verifying that they are not aware yet, but unsolicited spam is not helpful. It will just frustrate people.
A number of things have happened since the last update.
Today, on the 27th of March 2021, The Coding Den was subjected to a social engineering attack that lead to a brief hostile takeover of the server before the situation was brought under control by staff. We are sharing this statement as a public service announcement on the methodology used in the scam and possible remediations to prevent it, in order to help other staff teams avoid becoming victims of it.
The attack proliferates as follows:
- The attacker will look for a staff member who is presently offline. This will ensure that it appears as if the staff member's account was globally banned and forcefully booted offline.
- It is within the attacker's interest to choose a target with the highest possible privileges (to do the maximum amount of damage), meaning that they will likely prefer administrators over moderators and so forth.
- The attacker will create a new Discord account with the same name and profile picture as the target.
- The attacker will approach a staff member, claiming
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'
instead ofconst foo = require('foo')
to import the package. You also need to put"type": "module"
in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)
from CommonJS instead ofrequire(…)
. - Stay on the existing version of the package until you can move to ESM.