AES128 uses a 16 byte secret key.
const key = new Uint8Array(16);
crypto.getRandomValues(key);
import { config } from "@/app/config"; | |
import { createLogger } from "@/app/observability"; | |
import { useEffect } from "react"; | |
const { appEnv } = config; | |
const logger = createLogger("developer/storybook"); | |
export const useToggleStorybook = () => { | |
const [isStorybookEnabled, setIsStorybookEnabled] = useState(false) |
These are instructions for setting up a SvelteKit demo project and deploying it to Firebase with framework aware hosting.
Setup a new SvelteKit project with:
// zod schema | |
z.object({ | |
// valid if string or: | |
optional: z.string().optional(), // field not provided, or explicitly `undefined` | |
nullable: z.string().nullable(), // field explicitly `null` | |
nullish: z.string().nullish(), // field not provided, explicitly `null`, or explicitly `undefined` | |
}); | |
// type | |
{ |
For some reason, it is surprisingly hard to create a bootable Windows USB using macOS. These are my steps for doing so, which have worked for me in macOS Monterey (12.6.1) for Windows 10 and 11. After following these steps, you should have a bootable Windows USB drive.
You can download Windows 10 or Windows 11 directly from Microsoft.
After plugging the drive to your machine, identify the name of the USB device using diskutil list
, which should return an output like the one below. In my case, the correct disk name is disk2
.
Recently Dan Abramov has been linking drafts of a new documentation page for useEffect
, which has kicked off discussion about where you are "supposed" to do data fetching in a "React app". Some of that conversation is happening on Twitter such as here: https://twitter.com/dan_abramov/status/1532540685710147589
Within the draft and repeated on Twitter, there is a recommendation that for data fetching you should use third party libraries as either tools like React Query or useSWR or via frameworks such as Next and Remix which include integrated data fetching solutions. Writing your own data fetching using useEffect is suggested to be only a fallback in case you can't do those things, and not really a preferred recommendation.
This idea is hitting backlash, with a basic detracting idea that boils down to: React is a client side framework, how can it not include as a feature an important and common requirement like data loading.
export const Cartrip = [ | |
{ | |
TripInfoID: 33798, | |
driver: "347722874183", | |
CarID: 646, | |
Speed: 4.0, | |
Lt: 20.800825, | |
Ln: 106.903534, | |
Oil: 427, | |
Acc: "Bật", |
#!/bin/bash | |
sudo apt install software-properties-common && sudo add-apt-repository ppa:ondrej/php -y | |
sudo apt update | |
sudo apt upgrade -y | |
sudo apt install php8.1 -y | |
sudo apt install php8.1-bcmath -y | |
sudo apt install php8.1-bz2 -y | |
sudo apt install php8.1-cli -y | |
sudo apt install php8.1-common -y | |
sudo apt install php8.1-curl -y |
// Expo SDK40 | |
// expo-blur: ~8.2.2 | |
// expo-haptics: ~8.4.0 | |
// react-native-gesture-handler: ~1.8.0 | |
// react-native-reanimated: ^2.0.0-rc.0 | |
// react-native-safe-area-context: 3.1.9 | |
import React, { useState } from 'react'; | |
import { | |
Image, |
This is a way to install and set up Nginx, MariaDB and PHP-FPM on Ubuntu 20.04.
NOTE: This has been prepared for ease of use in mind, not security, mostly in development machine. Please do not use these instructions to setup on a public server environment. Use other proper manuals instead.
First fetch the latest package list of Ubuntu:
$ sudo apt update