Skip to content

Instantly share code, notes, and snippets.

View Mastersam07's full-sized avatar
๐Ÿš€
building amazing things

Samuel Abada Mastersam07

๐Ÿš€
building amazing things
View GitHub Profile
void main(){
var squares = 64;
numberOfGrain(squares);
}
void numberOfGrain(int numberOfSquares){
// To get the total sum of grians we use a sum of GP where n is number of squares
// common ratio r is 2 (grains in square two / grains in square one)
// Sum of GP = a*(r^n-1)/r-1 where r=2;n=64
@Mastersam07
Mastersam07 / day1130.dart
Created April 9, 2020 09:31
simulating a bank account
// Banks database containing all created accts both active and inactive
List<BankAccount> _bankDB = [];
BankAccount myBankAccount(String accountNumber){
//function that checks if acct exists in DB else create new acct
var hiddenAccNumber = List.generate(accountNumber.length-4,(_)=>'*').join("")+accountNumber.substring(accountNumber.length-4);
try{
var x = _bankDB.firstWhere((b)=>b.accountNumber==accountNumber);
print('Account $hiddenAccNumber active....');
return x;
@Mastersam07
Mastersam07 / day1230.dart
Last active April 16, 2020 21:32
basic list operations
void main() {
print(append([1, 2], [3, 4, 5])); // append
print(concatenate([
[1, 2, 3],
[4, 5, 6] // concatenate
]));
print(filter(isOdd, [1, 2, 3, 4, 5, 6, 7, 8, 9, 0])); // filter
print(length([1, 2, 3, 4, 5, 6, 7])); // length
print(map(cubeIt, [1, 2, 3, 4, 5, 6])); // map
print(reverse([0, 1, 2, 3, 4, 5])); // reverse
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false, // removing the debug tag
home: new Home(), // the app
),
);
}
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'WhatsApp',
debugShowCheckedModeBanner: false, // remove debug banner
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'WhatsApp',
debugShowCheckedModeBanner: false,
@Mastersam07
Mastersam07 / day1630.dart
Created April 17, 2020 16:31
Profile page whatsapp
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'WhatsApp',
debugShowCheckedModeBanner: false,
@Mastersam07
Mastersam07 / day2230.dart
Created April 21, 2020 21:39
Day 22 challenge
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
home: new MyHomePage(), // runApp();
));
}
class MyHomePage extends StatefulWidget {
/// EXC attendance form UI withoout onpressed method
/// and validation
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
debugShowCheckedModeBanner: false,
home: new MyHomePage(), // runApp();
));
/// ECX attendance form with form validation on
/// button pressed
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
debugShowCheckedModeBanner: false,
home: new MyHomePage(), // runApp();
));