Skip to content

Instantly share code, notes, and snippets.

@sonyerg
sonyerg / index.html
Created July 29, 2024 08:23
Random Quote Machine
<div class="container">
<div class="row">
<div class="col-md-12">
<div id="quote-box" class="text-center">
<div id="text" class="my-auto">
<h1 id="quote">Quotation Here</h1>
</div>
<h3 id="author" class="items-center">Author Here</h3>
<div class="row justify-content-center">
<div class="col-auto">
@sonyerg
sonyerg / fizz_buzz.dart
Last active December 5, 2023 03:43
Fizz Buzz problem
void main() {
for (int i = 1; i <= 50; i++) {
String output = '';
if (i % 3 == 0) output += 'Fizz';
if (i % 5 == 0) output += ' Buzz';
print(output.isEmpty ? i.toString() : output.trim());
}
}
@sonyerg
sonyerg / class_objects.dart
Last active December 4, 2023 02:24
Classes and objects in Dart: A study
class Car {
String model;
String brand;
int _year;
Car(this.brand, this.model, this._year);
void honk() {
print('beep beep');
}
@sonyerg
sonyerg / dart_classes.dart
Last active December 4, 2023 02:25
Understanding Class, properties, methods, and instances.
class Dog {
String name;
int age;
Dog({required this.name, required this.age});
void bark() {
print('Woof! My name is $name and I am $age years old.');
}
}
import 'dart:async';
void main() {
Future<dynamic>.delayed(
Duration(seconds: 2),
() {
return 100;
},
)
.then(
@sonyerg
sonyerg / main.dart
Last active March 19, 2023 07:33 — forked from filiph/main.dart
Flutter Codelabs: Namer codelab advanced version
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables
import 'package:english_words/english_words.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
void main() {
runApp(MyApp());
}
@sonyerg
sonyerg / exercise_2.dart
Created March 14, 2023 22:47
Dart Basic: Exercise 2
void main() {
//Question 1
/*
* Using the variable defined at the bottom, print the following lines to the console
*
* mcdonald's - best burgers ever!
* MCDONALD'S - BEST BURGERS EVER!
* Contains the word 'best'? true
* McDonald's - best breakfast muffin ever!
@sonyerg
sonyerg / exercise_1.dart
Created March 14, 2023 07:12
Dart Basics Exercise 1
void main() {
//Exercise 1
/*Question 1
Use the 3 variables declared below to print out the following
to the console:
Paul, a 35 year old, paid $400 to repair his father's car.
@sonyerg
sonyerg / variables.dart
Last active March 14, 2023 06:38
Dart lessons: Variables
void main() {
int firstNumber = 10;
int secondNumber = 51;
String textHello = 'Hello world';
double average = (firstNumber + secondNumber) / 2;
print('The average of ' + firstNumber.toString() + ' and '
+ secondNumber.toString() + ' is ' + average.toString());