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 / document_modeling_1.md
Last active December 20, 2021 06:08
โจทย์หนึ่งในหลักสูตร Data Modeling for NoSQL & Documented-based Database โดย https://www.facebook.com/nextflow

Scenario

ลูกค้าเป็นเจ้าของธุรกิจหาคู่ ต้องการแอพพลิเคชั่นที่ไว้สำหรับหาคู่ โดยการนัดไปทำกิจกรรมในสถานที่ต่างๆ ในสถานการณ์ที่ยังมีโรคระบาดในปัจจุบันซึ่งมีการผ่อนปรนให้สามารถใช้ชีวิตได้ตามปกติ เพียงแต่ต้องมีการสวมหน้ากาก ตรวจอุณหภูมิ ล้างมือ

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

  1. ผู้ใช้สามารถเห็นผู้ใช้ท่านอื่นในบริเวณใกล้ๆ ได้ แต่ไม่สามารถระบุตำแหน่งที่แน่นอนได้
  2. ผู้ใช้สามารถนัดผู้ใช้ท่านอื่น ไปเจอกันในสถานที่ต่างๆ ที่ระบบมีบันทึกไว้ได้
  3. ผู้ใช้สามารถย้อนดูว่า ได้มีการนัดผู้ใช้ชื่ออะไร ไปสถานที่ชื่ออะไร วันไหนมาแล้วบ้าง
@teerasej
teerasej / random_user_model.dart
Created October 28, 2021 16:03
A dart model class represents JSON data return from randomuser.me, edit to support non-nulllable in Flutter 2.0
// Copyright (c) 2021 Teerasej Jiraphatchandej
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
// To parse this JSON data, do
//
// final randomUserModel = randomUserModelFromJson(jsonString);
import 'dart:convert';
@teerasej
teerasej / covid_stat_model.dart
Created October 28, 2021 15:54
Thailand's covid stat daily model class with support non-nullable in Flutter 2.0
// To parse this JSON data, do
//
// final covidStatModel = covidStatModelFromJson(jsonString);
import 'dart:convert';
List<CovidStatModel> covidStatModelFromJson(String str) =>
List<CovidStatModel>.from(
json.decode(str).map((x) => CovidStatModel.fromJson(x)));
@teerasej
teerasej / find_parent_widget_with_specific_type.dart
Created October 10, 2021 08:49
If you want to looking for specific type of ancestor widget (yes, parent widget) you can use following methods below.
// If you're familair with 'parent' term, Flutter call its as 'ancestor'
import 'package:flutter/material.dart';
class NextflowExampleFindParentWidget extends StatefulWidget {
NextflowExampleFindParentWidget({Key? key}) : super(key: key);
@override
_NextflowExampleFindParentWidgetState createState() =>
_NextflowExampleFindParentWidgetState();
@teerasej
teerasej / main.dart
Created September 24, 2021 00:47
cleaned main.dart for start project with out commenting
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
@teerasej
teerasej / build.gradle
Last active May 16, 2021 04:26
Fix error on compile time "The number of method references in a .dex file cannot exceed 64K." in Flutter project
// android/app/build.gradle
android {
//...
defaultConfig {
//...
multiDexEnabled true
}
@teerasej
teerasej / MainActivity.cs
Last active May 4, 2021 11:28
An example that use Zebra Link-OS SDK's PrintStoredFormat
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Android.App;
using Android.Net;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using AndroidX.AppCompat.App;
@teerasej
teerasej / main.dart
Created April 8, 2021 02:48
Show a toast message in Flutter App
Fluttertoast.showToast(
msg: "This is Center Short Toast",
);
@teerasej
teerasej / launch.json
Last active February 27, 2021 13:37
VSCode's launch.json that can be used in debugging deno RESTful web api
{
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Debug Deno",
"program": "index.ts",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": [
@teerasej
teerasej / main.dart
Created February 15, 2021 02:35
Form example with saved and validation
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(