Skip to content

Instantly share code, notes, and snippets.

View ashwynh21's full-sized avatar
🤓
Focused

Ashwyn D. Horton ashwynh21

🤓
Focused
  • The Bridge
  • Manzini, eSwatini
  • 07:58 (UTC +02:00)
View GitHub Profile
@ashwynh21
ashwynh21 / completer.ts
Created December 7, 2021 11:09
A class modelled from the Completer in dart, that has promise functionality but also allows external resolution and rejection without the need for scoping
/*
* completer -
*
* the definition of this class mimics the functionality of the completer class that we have defined in the dart
* packages that lets you deal with unscoped promises instances that can be rejected and resolved in any part of the
* application so long as you are able to pass the reference to the context properly
* */
type Resolvable<T> = T | PromiseLike<T>;
@ashwynh21
ashwynh21 / compound_interest.cpp
Last active December 3, 2021 08:04
A simple program to compute compound interest using loops and printing the result on CLI.
// in this program we are going to be calculating compound interest using a looping
// algorithm.
//
// firstly, we discuss the solution that we have in mind. since we are required to
// compute this without a formula but using loops we are going to define a function
// that will represent the function call.
//
// let us start by getting the resources we are going to need
#include <iostream>