Skip to content

Instantly share code, notes, and snippets.

View graphicbeacon's full-sized avatar
🏠
Working from home

Jermaine Oppong graphicbeacon

🏠
Working from home
View GitHub Profile
@graphicbeacon
graphicbeacon / Dockerfile
Created May 17, 2020 18:06
Setup Dart with Docker
# ./Dockerfile
FROM google/dart-runtime
@graphicbeacon
graphicbeacon / main.dart
Created February 7, 2021 22:29
Convert map object to yaml in Dart
void main() {
final json = {
'name': 'package_name',
'version': '1.0.0',
'dependencies': {
'dep1': '^1.0.0',
'dep2': '^1.5.0',
'dep3': {
'git': 'https://github.com/graphicbeacon',
'home': {
@graphicbeacon
graphicbeacon / index.html
Created September 7, 2020 17:25
Dispatching custom events example for Dart Web projects
<input type="text" />
@graphicbeacon
graphicbeacon / async-gen.dart
Created September 3, 2020 15:46
Async Generators example
import 'dart:async';
void main() {
// asynchronousNaturalsTo(10).listen(print);
final controller = asyncNaturalsTo(10);
controller.stream.listen((n) => print('YEss $n'),
onDone: () {
controller.close();
});
@graphicbeacon
graphicbeacon / main.dart
Last active June 26, 2020 09:00
Flutter Grid example with highlighted square
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
debugShowCheckedModeBanner: false, home: Scaffold(body: BoxApp())));
}
class BoxApp extends StatefulWidget {
@override
BoxAppState createState() => BoxAppState();
@graphicbeacon
graphicbeacon / index.html
Created June 20, 2020 22:07
Centering card with Materialize example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
@graphicbeacon
graphicbeacon / index.html
Last active May 20, 2020 14:13
WebAssembly in Dart for web example
<!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" />
@graphicbeacon
graphicbeacon / main.dart
Created March 19, 2020 20:11
"Learn Dart Before you Flutter" Youtube video solution
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 March 22, 2020 17:02
Flutter slideout container with handle
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Page(),
),
),
);
@graphicbeacon
graphicbeacon / main.dart
Created March 21, 2020 21:03
Slideout container
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Page()
)
));
class Page extends StatefulWidget {