Skip to content

Instantly share code, notes, and snippets.

View developerjamiu's full-sized avatar
💙

Jamiu Okanlawon developerjamiu

💙
View GitHub Profile
@developerjamiu
developerjamiu / expandable_text.dart
Created March 25, 2024 11:08
A collapsible text demo in Flutter
void main() {
runApp(const App());
}
class App extends StatelessWidget {
const App({
super.key,
this.feeds = const [
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi at tempor eros. Aenean ipsum elit, porttitor id pretium id, vehicula non sapien. Praesent consequat quis urna vel bibendum. Praesent quis mauris porta, ultricies ligula ac, suscipit lorem. In ut aliquet dui. Cras id turpis nec erat ultricies semper. Sed pellentesque, augue nec consequat tempor, erat tortor gravida ipsum, at maximus nulla enim nec nulla. Suspendisse eu lobortis eros, ac placerat tellus. Aenean ultricies, justo eget consequat scelerisque, nunc arcu laoreet.',
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi at tempor eros. Aenean ipsum elit, porttitor id pretium id, vehicula non sapien.',
import 'package:crypto/crypto.dart';
void main {
final key = Key.fromUtf8('qwertyuiopasdfghjklzxcvbnmqwertyuiop');
final encrypter = Encrypter(AES(key));
encrypted = encrypter.encrypt('stringToEncrypt', iv: IV.fromLength(16));
}
import 'dart:math';
main() {
var rng = Random();
final list = <int>[];
while (list.length < 10) {
final int randomNumber = rng.nextInt(100);
@developerjamiu
developerjamiu / pointer_demo.dart
Last active May 10, 2022 09:10
In your programming language of choice, pass a pointer to a function (A) to another function (b), then call A from B.
void main() {
b(() => print('I am function a passed to function b'));
}
/// Calling a function a from b
void b(Function a) {
print('This is the beginning of function b');
print('before calling function a from b');
a();
print('after calling function a');
void main() {}
/// A piece of code checking for errors using exceptions
/// Checking using exceptions
void checkingForExceptions() {
try {
/// performing operation
} on FormatException {
/// Handle exception
@developerjamiu
developerjamiu / oop.dart
Last active May 10, 2022 09:25
A snippet of code describing OOP. It is not near perfect
/// Please note that some instantiations are to be done in the main method
/// I placed it orderly (following the class created) for clarity and simplicity.
void main() {}
/// OOP is a computer programming model that organizes software development around entities
/// and objects, rather than functions and logic.
/// The building blocks of OOP includes the:
@developerjamiu
developerjamiu / dry_demo.dart
Last active May 10, 2022 09:08
A snippet of code violating the Don't Repeat Yourself (DRY) principle and then, fixing it.
import 'package:intl/intl.dart';
void main() {
/// This assessment is done using the Dart Programming Language
/// The next lines of code describes a snippet of code violating the DRY Principle
/// DRY basically means "Don't Repeat Yourself" and it is aimed at reducing repititions in Software Engineering
/// A snippet of code violating the DRY principle
/// In the code below I need to format two dates [startDate] and [endDate] using a dart
@developerjamiu
developerjamiu / main.dart
Created October 28, 2020 10:21
Snippet showing a custom app bar
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: CustomAppBarDemo(),
),
);