Skip to content

Instantly share code, notes, and snippets.

View anoochit's full-sized avatar

Anuchit Chalothorn anoochit

View GitHub Profile
@anoochit
anoochit / weather.dart
Created February 6, 2022 04:32
weather model
// To parse this JSON data, do
//
// final cityWeather = cityWeatherFromJson(jsonString);
//import 'package:meta/meta.dart';
import 'dart:convert';
CityWeather cityWeatherFromJson(String str) => CityWeather.fromJson(json.decode(str));
String cityWeatherToJson(CityWeather data) => json.encode(data.toJson());
@anoochit
anoochit / weather.dart
Created February 6, 2022 04:09
city weather model
// To parse this JSON data, do
//
// final cityWeather = cityWeatherFromJson(jsonString);
//import 'package:meta/meta.dart';
import 'dart:convert';
CityWeather cityWeatherFromJson(String str) => CityWeather.fromJson(json.decode(str));
String cityWeatherToJson(CityWeather data) => json.encode(data.toJson());
@anoochit
anoochit / weather.dart
Created February 6, 2022 04:08
service weather
import 'package:http/http.dart' as http;
import 'package:http/http.dart';
//
//
// https://api.openweathermap.org/data/2.5/weather?q=Bangkok&units=metric&appid=92f90171a9639b008090aa98c05df965
Future<Response> getCityWeather({required String name}) async {
String endpoint = "https://api.openweathermap.org/data/2.5/weather?q=" +
name +
@anoochit
anoochit / Podfile
Last active September 24, 2022 13:08
speedup build time for firestore
target 'Runner' do
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '9.5.0'
....
@anoochit
anoochit / bmi_calculator.dart
Created February 5, 2022 08:30
bmi_calculator
// elevate button
ElevatedButton(
child: const Text("Calculate BMI"),
onPressed: () {
double bmi = _weight / ((_height / 100) * (_height / 100));
setState(() {
if (bmi < 18.5) {
_result = "Underweight";
_color = Colors.lightBlue;
} else if (bmi < 25) {
@anoochit
anoochit / adduser.js
Created December 27, 2021 06:22
add user demo
// add demo member
var timeStamp = new Date().getTime() * 1000;
auth
.createUser({
email: "user@example.com",
emailVerified: true,
password: "demodemo",
disabled: false,
})
.then((userRecord) => {
@anoochit
anoochit / beer_service.dart
Created August 31, 2021 08:45
Sample Dart http call REST API
import 'dart:developer';
import 'package:http/http.dart' as http;
import 'package:mobile/models/product.dart';
String baseUrl = "http://7fa6-2001-fb1-148-9046-b9ee-2df1-108f-68d8.ngrok.io";
Map<String, String> headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
@anoochit
anoochit / main.cpp
Created August 16, 2021 11:58
popdog BLE mouse auto click
#include <Arduino.h>
#include <BleMouse.h>
BleMouse bleMouse;
void setup() {
Serial.begin(115200);
Serial.println("Starting BLE work!");
bleMouse.begin();
}
@anoochit
anoochit / esp32_popcat.cpp
Last active August 16, 2021 06:15
esp32 ble keyboard auto click popcat!!
#include <Arduino.h>
#include <BleKeyboard.h>
BleKeyboard bleKeyboard;
void setup() {
Serial.begin(115200);
Serial.println("Starting BLE work!");
bleKeyboard.begin();
}
@anoochit
anoochit / main.dart
Created July 5, 2021 04:41
sample horizontal listview
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
title: MainMenu(),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(