Skip to content

Instantly share code, notes, and snippets.

View teerasej's full-sized avatar
🎯
Teaching about cross platform mobile app development and A.I

Teerasej Jiraphatchandej teerasej

🎯
Teaching about cross platform mobile app development and A.I
View GitHub Profile
@teerasej
teerasej / .htaccess
Created January 3, 2024 06:25
In deploying React application on apache web server which relative URL's path. You need to add a rewrite rule for routing request into that target deployed directory on the web server
# here is what you need to addd
# Avoid putting the rule into '#BEGIN ...' and '#END ...' section to prevent overwrite activity from the platform.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^vite-react-app-deploy-lab(/(.*))?$ /vite-react-app-deploy-lab/index.html [L]
</IfModule>
# BEGIN WordPress
@teerasej
teerasej / vite.config.ts
Created January 3, 2024 06:19
Config vite.config.ts to set the root of assets to the relative path
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
base: '/vite-react-app-deploy-lab/',
})
@teerasej
teerasej / App.tsx
Created January 3, 2024 06:13
Setting basename property for Browser Router component
import './App.css'
import { BrowserRouter as Router, Route, Routes, Link } from 'react-router-dom'
import { Home } from './pages/Home'
import { Setting } from './pages/Setting'
function App() {
return (
<>
@teerasej
teerasej / tsconfig.json
Created December 5, 2023 10:49
typescript config file for simple build to dist directory
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
Header 1 Header 2 Header 3
Row 1, Cell 1 Cell 2 Cell 3
Row 2, Cell 1 Cell 5 Cell 6
Row 3, Cell 1 Cell 8 Cell 9
@teerasej
teerasej / sha.sh
Created May 19, 2022 09:25
Command to get SHA Certificate from your mobile application development with firebase
# MacOS
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
# Windows
keytool -list -v -keystore "\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
# Linux
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
@teerasej
teerasej / mapping.dart
Created January 16, 2022 05:37
Good guideline to convert JSON (map) to instance of a class in Flutter/Dart app
class AnnouncementMessage {
String? auctionSequenceId;
String? annoucementText;
AnnouncementMessage({this.auctionSequenceId, this.annoucementText});
static AnnouncementMessage fromMap(Map<String, dynamic> json) {
return AnnouncementMessage.fromJson(json);
}
@teerasej
teerasej / users.js
Last active December 22, 2021 08:04
// schemas/user.js
import mongoose from 'mongoose';
import Joi from 'joi';
import passwordComplexity from 'joi-password-complexity';
import bcrypt from 'bcrypt';
const SALT_ROUNDS = 12;
@teerasej
teerasej / index.js
Last active December 22, 2021 08:04
import express from 'express';
import mongoose from 'mongoose';
import UserModel from './schemas/user.js';
const app = express();
const port = 3000;
app.use(express.json());
@teerasej
teerasej / document_modeling_2.md
Created December 20, 2021 06:11
โจทย์หนึ่งในหลักสูตร Data Modeling for NoSQL & Documented-based Database โดย https://www.facebook.com/nextflow

Scenario

ลูกค้าเป็นเจ้าของธุรกิจคลีนิกรักษาสัตว์ ต้องการแอพพลิเคชั่นที่ทำให้คุณหมอ และเจ้าของคนไข้ ดูข้อมูลต่างๆ ได้ดังนั้

ให้ออกแบบโครงสร้างข้อมูลที่จะเก็บบนฐานข้อมูล ตามเงื่อนไขดังนี้

  1. คุณหมอสามารถเห็นนัดหมายคนไข้ประจำวันนั้นได้
  2. คุณหมอสามารถดูรายละเอียดของคนไข้ได้ เช่น ชื่อ อาการ ประวัติการรักษา
  3. เจ้าของคนไข้ สามารถดูว่าสัตว์เลี้ยงของตัวเอง มีการรักษาอะไรไปแล้วบ้าง
  4. เจ้าของคนไข้ สามารถดูว่าการรักษาแต่ละครั้ง คุณหมอคนไหนเป็นคนรักษา