Skip to content

Instantly share code, notes, and snippets.

View anhtuank7c's full-sized avatar

Tuan Nguyen anhtuank7c

View GitHub Profile
MarceloPrado / useToggleStorybook.ts
Created October 18, 2023 12:32
Dynamically toggle between storybook and app
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)
coehne /
Last active May 23, 2024 14:26
Host SvelteKit on Firebase Hosting with Framework Aware Hosting

SvelteKit + Firebase Hosting

These are instructions for setting up a SvelteKit demo project and deploying it to Firebase with framework aware hosting.

Installation steps

Setup SvelteKit

Setup a new SvelteKit project with:

samsch / .md
Created June 4, 2022 00:08
Why React Data Fetching is Hard (right now)

Why React Data Fetching is Hard (right now)


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:

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.

zhenguet / data.js
Last active February 22, 2022 01:28
export const Cartrip = [
TripInfoID: 33798,
driver: "347722874183",
CarID: 646,
Speed: 4.0,
Lt: 20.800825,
Ln: 106.903534,
Oil: 427,
Acc: "Bật",
DenisJunio /
Last active May 9, 2024 10:38
Laravel - PHP 8.1 Extensions - Ubuntu
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
eveningkid / react-native-reanimated-drag-sort_apple-music.jsx
Last active June 13, 2024 07:13
React Native Reanimated 2 Multiple Drag and Sort: Apple Music Example
// 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 {
nd3w /
Last active April 8, 2024 10:28
How to Install Nginx, MariaDB, PHP-FPM on Ubuntu 20.04

How to Install Nginx, MariaDB, PHP-FPM on Ubuntu 20.04

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.

$ sudo apt update


import 'package:firedart/firedart.dart';
import 'package:hive/hive.dart';
/// Stores tokens using a Hive store.
/// Depends on the Hive plugin:
class HiveStore extends TokenStore {
static const keyToken = "auth_token";
static Future<HiveStore> create() async {
// Make sure you call both:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
// @flow
import { map, is } from 'rambdax'
import type { DirtyRaw } from '@nozbe/watermelondb/RawRecord'
import type { SyncLog } from '@nozbe/watermelondb/sync'
// beginning, end, length
const censorValue = (value: string): string =>
`${value.slice(0, 2)}***${value.slice(-2)}(${value.length})`
const shouldCensorKey = (key: string): boolean =>