Skip to content

Instantly share code, notes, and snippets.

View anoochit's full-sized avatar
😊

Anuchit Chalothorn anoochit

😊
View GitHub Profile
// (6) set value to drop down here
dev.log('goto page with docId = $value');
snapshot.data!.docs.where((e) => e.id == value).forEach((e) {
dev.log('${e.data()}');
setState(() {
dropdownValue = value.toString();
// set your value here
dev.log(e["timestamp"]);
});
});
// show dropdown
Center(
child: Container(
height: 50,
padding: const EdgeInsets.only(
left: 10.0,
right: 10.0,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.0),
@anoochit
anoochit / dropdown.dart
Created June 2, 2022 02:10
sample dropdown in future builder
// get log history
FutureBuilder(
future: FirebaseFirestore.instance.collection('sick').doc(widget.idcard).collection('logs').get(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
}
if (!snapshot.hasData) {
return Text('Loading...');
@anoochit
anoochit / note.txt
Created May 24, 2022 03:03
Flutter 3 live session note
What's new in Flutter 3 ?
===========
- Fully support 6 platforms iOS, Android, Web, macOS, Linux, Windows
- Flutter SDK on macOS now support ARM M1 and x86
- macOS desktop app, usecase from SuperList
- Flutter for Web has a better performance aka List/Scroll
@anoochit
anoochit / gift.sol
Last active May 11, 2022 23:59
social network wallet - gift token
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts@4.6.0/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts@4.6.0/token/ERC20/ERC20.sol";
contract GIFT is ERC20 {
using SafeERC20 for ERC20;
constructor() ERC20("GIFT Token", "GIFT") {
_mint(msg.sender, 1000000000 * 10 ** decimals());
@anoochit
anoochit / swap.sol
Created May 11, 2022 23:53
social network wallet - swap
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts@4.6.0/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts@4.6.0/token/ERC20/ERC20.sol";
contract SWAPToken {
using SafeERC20 for ERC20;
@anoochit
anoochit / 05_faucet.sol
Created April 26, 2022 11:49
solidity faucet coin
// SPDX-License-Identifier: MIT
// Author: Jacob Suchorabski
pragma solidity >= 0.7.0 <= 0.7.4;
contract Faucet{
address owner;
mapping (address => uint) timeouts;
event Withdrawal(address indexed to);
@anoochit
anoochit / default
Created April 13, 2022 04:08
nginx reverse proxy script for vue frontend for mars blockchain
..
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
proxy_pass http://localhost:3000/;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
@anoochit
anoochit / marsd.service
Created April 13, 2022 04:06
mars unit file for systemd
#/etc/systemd/system/marsd.service
[Unit]
Description=Mars Node
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/root
ExecStart=/root/go/bin/marsd start --
@anoochit
anoochit / start.sh
Created April 13, 2022 04:03
mars blockchain start vue front-end script for using with pm2
#!/bin/bash
cd /root/mars/vue
npm run dev