Skip to content

Instantly share code, notes, and snippets.

View isaacssemugenyi's full-sized avatar

Isaac Ssemugenyi isaacssemugenyi

View GitHub Profile
// config with dotenv
impl Config {
pub fn from_env() -> Result<Self, ConfigError> {
let s = config::Config::builder()
.add_source(config::Environment::default())
.build()?;
s.try_deserialize()
}
}
package builder;
import java.util.ArrayList;
import java.util.List;
public class Car {
private String make;
private String name;
private String color;
private int model;
package builder;
import java.util.ArrayList;
import java.util.List;
public class Car {
private String make;
private String name;
private String color;
private int model;
// remove the countriesPresent method in the inner Builder class and replace it with the method below
public Builder addCountry(String countriesPresent){
this.countriesPresent.add(countriesPresent);
return this;
}
// Inside of .countriesPresent(List.of("Mexico", "Brazil")) with .addCountry("Kenya").addCountry("Uganda") in the Main.java
Car car3 = new Car.Builder()
.make("Ford")
package builder;
import java.util.ArrayList;
import java.util.List;
public class Car {
private String make;
private String name;
private String color;
private int model;
package builder;
import java.util.ArrayList;
import java.util.List;
public class Car {
private String make;
private String name;
private String color;
private int model;
package builder;
import java.util.ArrayList;
import java.util.List;
public class Car {
private String make;
private String name;
private String color;
private int model;
@isaacssemugenyi
isaacssemugenyi / Step 1: Create API User.MD
Created December 28, 2023 13:56 — forked from chaiwa-berian/Step 1: Create API User.MD
Testing MTN MoMo Collection API in Sandbox using Postman

A. Checklist

  • To create an API User, you need the following things in place: X-Reference-Id and Ocp-Apim-Subscription-Key

1. X-Reference-Id

  • This is used as User ID since the Sandbox is a Mock Environment so we kinda create our own ids and send them over to the sandbox so it can uniquely identify the user
  • Get the value for this here: https://www.uuidgenerator.net/api/version4
  • Remember to keep this safely as we will use it when configuring our POST request
  • Lets say you have your X-Reference-Id as: 9f92971b-cd2e-4feb-9053-0b14d53ac4f5

2. Ocp-Apim-Subscription-Key

  • Get this from the Primary or Secondary Key of your Collections | Enable remote collection of bills, fees or taxes subscription.
<script setup>
import SwitchItem from '../components/SwitchItem.vue'
import SwitchItem2 from '../components/SwitchItem2.vue'
</script>
<template>
<main>
<SwitchItem />
<SwitchItem2 />
</main>
// using a switch
const changeComponent = computed(() => {
switch (user.value) {
case 'admin':
return AdminItem
case 'distiguished':
return DistinguishedItem
default:
return GuestUser