--- | |
import type { ImageMetadata, ImageTransform } from "astro"; | |
import { getImage } from "astro:assets"; | |
import LoadableImage from "./LoadableImage.astro"; | |
type Props = { | |
src: ImageMetadata; | |
alt: string; | |
/** | |
* Array of screens to generate the image for i.e [320, 480, 1200] |
These are VMs running built with JavaScript/WASM allowing you to run an operating system within your browser, all client side.
# nix-env --install --file ./default.nix | |
let | |
nixpkgs = builtins.fetchTarball { | |
url = "https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz"; | |
sha256 = "0q7rnlp1djxc9ikj89c0ifzihl4wfvri3q1bvi75d2wrz844b4lq"; | |
}; | |
config = { | |
allowUnfree = true; | |
}; |
I'm a Rust newbie, and one of the things that I've found frustrating is that the default docker build
experience is extremely slow. As it downloads crates, then dependencies, then finally my app - I often get distracted, start doing something else, then come back several minutes later and forget what I was doing
Recently, I had the idea to make it a little better by combining multistage builds with some of the amazing features from BuildKit. Specifically, cache mounts, which let a build container cache directories for compilers & package managers. Here's a quick annotated before & after from a real app I encountered.
This is a standard enough multistage Dockerfile. Nothing seemingly terrible or great here - just a normal build stage, and a smaller runtime stage.
// Easy Frontend | |
// Học FE đơn giản, dễ hiểu và đặc biệt phải vui ❤️ | |
// JS NÂNG CAO - Xử lý expired token trong Javascript như thế nào? | |
// ❓ Chuyện gì xảy ra nếu giữa chừng token bị expired? | |
// Ví dụ: 3 api requests đồng thời với nhau | |
// TRƯỜNG HỢP 1: Token chưa expired, vẫn còn tốt chán 🤣 | |
// --request 1--> |
This gist is an example of how you can simply install and run and extended Postgres using docker-compose
. It assumes that you have docker
and docker-compose
installed and running on your workstation.
- Requires
docker
anddocker-compose
- Clone via http:
git clone https://gist.github.com/b0b7e06943bd389560184d948bdc2d5b.git
- Make
load-extensions.sh
executable - Build the image:
docker-compose build
It took a few years, but I finally understand why member functions of classes in JavaScript aren't automatically bound to their objects, in particular when used in callback arguments.
In most object-oriented languages, functions are members of a class--they exist in memory only once, and when they are called, this
is
simply a hidden argument of the function which is assigned to the object that's calling it. Python makes this explicit by requiring that
the first argument of a class's member function be self
(Python's equivalent of this
--you can name self
whatever you want, but
self
is the convention).
class MyClass:
- Like C, but with garbage collection, memory safety, and special mechanisms for concurrency
- Pointers but no pointer arithmetic
- No header files
- Simple, clean syntax
- Very fast native compilation (about as quick to edit code and restart as a dynamic language)
- Easy-to-distribute executables