Skip to content

Instantly share code, notes, and snippets.

View grandnexus's full-sized avatar
:octocat:
Keep learning

Jason Choo grandnexus

:octocat:
Keep learning
View GitHub Profile
@grandnexus
grandnexus / hdb_num_flat.py
Created September 10, 2020 10:28 — forked from yuan3y/hdb_num_flat.py
Get the Number Of Units in Each HDB Flat Within a Range of Postal Code in Singapore
__author__ = 'yuan3y'
import xml.etree.ElementTree as ET
import urllib.request as re
import datetime
for post_code in range(510000,530000):
current_time = datetime.datetime.now()
unix_timestamp = str(int(current_time.timestamp() * 1000))
postal_code = str(post_code)
@grandnexus
grandnexus / machine_learning_process_thermometer_image.dart
Created July 11, 2020 16:42
The Art of Flutter: Machine Learning (Process Thermometer Image)
// Process Thermometer Image
bool isNumeric(String s) {
if (s == null) {
return false;
}
return double.tryParse(s) != null;
}
double convertRawTextToTemperature(String rawText) {
double digits = 0.0;
@grandnexus
grandnexus / machine_learning_process_crop_face_image.dart
Created July 11, 2020 16:39
The Art of Flutter: Machine Learning (Process Crop Face Image)
// Process Crop Face Image
Future<LogEntry> processCropFaceImage(File imageFile) async {
final DateTime now = DateTime.now();
final List<Image> images = <Image>[];
final List<Rect> boundingBoxes = <Rect>[];
final List<Person> people = <Person>[];
final Uint8List uImage = await imageFile.readAsBytes();
final ui.Image image = await decodeImageFromList(uImage);
@grandnexus
grandnexus / flutter_web_javascript_within_dart.dart
Created July 5, 2020 17:36
The Art of Flutter: Flutter Web (JavaScript Within Dart)
// JavaScript Within Dart
// Geo Location API
@JS('navigator.geolocation')
library geoLocation;
import 'package:js/js.dart';
@JS('getCurrentPosition')
external void getCurrentPosition(Function success(GeolocationPosition pos));
@grandnexus
grandnexus / flutter_web_browser_apis.dart
Created July 5, 2020 17:35
The Art of Flutter: Flutter Web (Browser APIs)
// Browser APIs
// Web Camera
// ignore: avoid_web_libraries_in_flutter
import 'dart:html' as html;
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
@grandnexus
grandnexus / flutter_web_basic_search_engine_optimization_manifest.dart
Created July 5, 2020 16:37
The Art of Flutter: Flutter Web (Basic Search Engine Optimization: manifest.json)
// Basic Search Engine Optimization (manifest.json)
{
"name": "The Art of Flutter",
"short_name": "ArtOfFlutter",
"start_url": ".",
"display": "minimal-ui",
"background_color": "#1389FD",
"theme_color": "#1389FD",
"description": "The Art of Flutter",
"orientation": "portrait-primary",
@grandnexus
grandnexus / flutter_web_basic_search_engine_optimization_index.dart
Last active July 5, 2020 16:35
The Art of Flutter: Flutter Web (Basic Search Engine Optimization: index.html)
// Basic Search Engine Optimization (index.html)
<html>
<head>
<base href="/" />
<meta charset="UTF-8" />
<meta content="IE=Edge" http-equiv="X-UA-Compatible" />
<meta name="HandheldFriendly" content="true" />
<!-- GOOGLE SEO -->
@grandnexus
grandnexus / flutter_web_responsive_widgets_custom_multi_child_layout.dart
Created July 5, 2020 16:02
The Art of Flutter: Flutter Web (Responsive Widgets: Custom Multi Child Layout)
// Custom Multi Child Layout
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@grandnexus
grandnexus / flutter_web_responsive_widgets_custom_single_child_layout.dart
Created July 5, 2020 16:00
The Art of Flutter: Flutter Web (Responsive Widgets: Custom Single Child Layout)
// Custom Single Child Layout
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@grandnexus
grandnexus / flutter_web_responsive_widgets_fractionally_sized_box.dart
Created July 5, 2020 15:48
The Art of Flutter: Flutter Web (Responsive Widgets: Fractionally Sized Box)
// Fractionally Sized Box
FractionallySizedBox(
widthFactor: 0.5,
heightFactor: 0.5,
child: Container(
color: Colors.black,
),
);