Skip to content

Instantly share code, notes, and snippets.

Avatar

Jermaine Oppong graphicbeacon

View GitHub Profile
@graphicbeacon
graphicbeacon / main.dart
Created Mar 19, 2020
"Learn Dart Before you Flutter" Youtube video solution
View main.dart
class Order {
var _id;
var _reference;
var date;
var code;
List<String> bookings;
Order(this._id, this._reference, {this.date});
Order.withDiscount(this._id, this._reference, [this.code]) {
date = DateTime.now();
@graphicbeacon
graphicbeacon / main.dart
Last active Mar 19, 2020
"Build Your Own Forms in Flutter" video tutorial
View main.dart
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Padding(
padding: const EdgeInsets.all(20),
child: PageForm()
)
)
@graphicbeacon
graphicbeacon / flippable_card.dart
Created Feb 28, 2020
Flippable card effect in Flutter
View flippable_card.dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@graphicbeacon
graphicbeacon / main.dart
Last active Feb 29, 2020
Solution code on "Flutter for React developers" YouTube tutorial
View main.dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math' as math;
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@graphicbeacon
graphicbeacon / main.dart
Created Dec 31, 2019
"Dart2Native File Server Tutorial" solution code for tutorial on YouTube
View main.dart
import 'dart:io';
import 'package:args/args.dart';
import 'package:http_server/http_server.dart';
main(List<String> arguments) async {
ArgParser parser = ArgParser()
..addOption('dir', defaultsTo: 'web')
..addOption('port', defaultsTo: '8085');
var parsedResults = parser.parse(arguments);
@graphicbeacon
graphicbeacon / main.dart
Last active Dec 31, 2019
"Dart File Upload Server Tutorial" solution for YouTube video tutorial
View main.dart
// bin/main.dart
import 'dart:io';
import 'package:mime/mime.dart';
main() async {
var server = await HttpServer.bind('localhost', 8085);
server.listen((request) async {
@graphicbeacon
graphicbeacon / main.dart
Created Nov 8, 2019
Code sample for 'Use Extension Methods in Dart' lesson on Egghead.io
View main.dart
import 'dart:async';
getDuration(int seconds) {
return Duration(seconds: seconds);
}
extension MyInt on int {
Duration get seconds => Duration(seconds: this);
DateTime monthsAgo() => DateTime.now().subtract(Duration(hours: 24 * 30 * this));
}
@graphicbeacon
graphicbeacon / main.dart
Last active Jul 8, 2019
Solution for "Understanding Reflection in Dart" video tutorial on YouTube
View main.dart
import 'dart:io';
import 'dart:mirrors';
main() async {
var server = await HttpServer.bind('localhost', 8085);
await for (HttpRequest req in server) {
// Create InstanceMirror type from which
// we retrieve metadata information
var ref = reflect(Endpoint(req));
@graphicbeacon
graphicbeacon / index.html
Created May 4, 2019
Sample code for Star Wars API search with delayed timeout.
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>API Search</title>
</head>
<body>
<input id="search" type="search" />
<div id="results"></div>
@graphicbeacon
graphicbeacon / index.html
Last active May 20, 2020
WebAssembly in Dart for web example
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="scaffolded-by" content="https://github.com/google/stagehand" />
<title>webassembly_example</title>
<link rel="stylesheet" href="styles.css" />
You can’t perform that action at this time.