Skip to content

Instantly share code, notes, and snippets.

View anhtuank7c's full-sized avatar

Tuan Nguyen anhtuank7c

View GitHub Profile
@MarceloPrado
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
coehne / Readme.md
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
samsch / .md
Created June 4, 2022 00:08
Why React Data Fetching is Hard (right now)

Why React Data Fetching is Hard (right now)

Context

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.

@zhenguet
zhenguet / data.js
Last active February 22, 2022 01:28
Journey
export const Cartrip = [
{
TripInfoID: 33798,
driver: "347722874183",
CarID: 646,
Speed: 4.0,
Lt: 20.800825,
Ln: 106.903534,
Oil: 427,
Acc: "Bật",
@DenisJunio
DenisJunio / install_php_8_1.sh
Last active May 9, 2024 10:38
Laravel - PHP 8.1 Extensions - Ubuntu
#!/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
@eveningkid
eveningkid / react-native-reanimated-drag-sort_apple-music.jsx
Last active March 18, 2024 02:16
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 {
Image,
@nd3w
nd3w / install-nginx-mariadb-phpfpm-on-ubuntu-20.04.md
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

Nginx

import 'package:firedart/firedart.dart';
import 'package:hive/hive.dart';
/// Stores tokens using a Hive store.
/// Depends on the Hive plugin: https://pub.dev/packages/hive
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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>HKAtrialFibrillationDetectionOnboardingCompleted</key>
<integer>1</integer>
<key>HKElectrocardiogramOnboardingCompleted</key>
<integer>3</integer>
</dict>
</plist>
// @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 =>