Skip to content

Instantly share code, notes, and snippets.

View anhtuank7c's full-sized avatar
🎯
Focusing

Tuan Nguyen anhtuank7c

🎯
Focusing
View GitHub Profile
@anhtuank7c
anhtuank7c / clean_code.md
Created January 21, 2024 09:03 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin
View clean_code.md

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@anhtuank7c
anhtuank7c / README.md
Last active January 17, 2024 03:08
Loại bỏ giọng nói trong video
View README.md
@anhtuank7c
anhtuank7c / cloudflare_workflow.yaml
Created January 7, 2024 07:18
Github workflow for deploying Sveltekit app to Cloudflare Pages
View cloudflare_workflow.yaml
# Deploy to Cloudflare Workers/Pages with Wrangler
# https://github.com/marketplace/actions/deploy-to-cloudflare-workers-with-wrangler
name: Deploy Pages
on:
push:
branches:
- main
pull_request:
jobs:
deploy:
@anhtuank7c
anhtuank7c / useToggleStorybook.ts
Created October 19, 2023 09:44 — forked from MarceloPrado/useToggleStorybook.ts
Dynamically toggle between storybook and app
View useToggleStorybook.ts
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)
@anhtuank7c
anhtuank7c / .gitignore
Created June 21, 2023 09:24 — forked from tatsuyasusukida/.gitignore
Node.js Docker Image that can uses FFmpeg
View Text.tsx
import { TranslateOptions } from 'i18n-js/typings'
import {StyleProp, Text as RNText, TextProps as RNTextProps, TextStyle} from 'react-native'
import { TxKeyPath, useI18n } from '../hooks/useI18n'
import { ThemeProps, useThemeColor } from './Themed'
const presets = {
default: {fontSize: 17, lineHeight: 24, fontWeight: 'normal'} as StyleProp<TextStyle>,
primary: {fontSize: 17, lineHeight: 24, fontWeight: '600'} as StyleProp<TextStyle>,
secondary: {fontSize: 17, lineHeight: 24, fontWeight: 'normal'} as StyleProp<TextStyle>,
header: {fontSize: 27, lineHeight: 34, fontWeight: '600' } as StyleProp<TextStyle>,
@anhtuank7c
anhtuank7c / cleanup_node_modules.sh
Created January 7, 2023 10:41
[Mac/Linux] List and remove all the node_modules at the current directory
View cleanup_node_modules.sh
#!/bin/bash
# Cleanup node_modules
echo "Calculate disk space for node_modules in all directory"
find . -name "node_modules" -type d -prune -print | xargs du -chs
echo "Remove all node_modules directory"
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
@anhtuank7c
anhtuank7c / const_keyword.dart
Last active June 23, 2022 07:15
Exploring const keyword in Dart
View const_keyword.dart
class Contact {
// Constructor is marked 'const' so all fields must be final.
final String name;
final int age;
// const at class level have to go along with static keyword
static const alive = true;
// const constructor
const Contact(this.name, this.age);
@anhtuank7c
anhtuank7c / final_keyword.dart
Last active June 18, 2022 15:02
Exploring final keyword in Dart
View final_keyword.dart
class Contact {
String name;
int age;
Contact(this.name, this.age);
@override
String toString() {
return "$name: $age";
}
@anhtuank7c
anhtuank7c / AudioCue.kt
Created April 20, 2022 02:53
AudioCue class, let initial this class to call speakOut function to speech the text.
View AudioCue.kt
package com.example;
import android.content.Context
import android.content.Context.AUDIO_SERVICE
import android.media.AudioAttributes
import android.media.AudioFocusRequest
import android.media.AudioManager
import android.os.Build
import android.os.Bundle
import android.speech.tts.TextToSpeech