Skip to content

Instantly share code, notes, and snippets.

View mtvbrianking's full-sized avatar

Brian Matovu mtvbrianking

View GitHub Profile
@mtvbrianking
mtvbrianking / laravel validation attributes.md
Created September 24, 2023 17:30
Laravel validation attributes

Issue

Attribute names are replaced. E.g 'from_account_id' to 'from account id'

{
    "errors": {
        "to_account_id": [
            "The to account id field and from account id must be different."
        ],
@mtvbrianking
mtvbrianking / chartjs_timeseries.html
Last active January 12, 2024 07:16
chart.js timeseries demo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>chart.js timeseries demo</title>
</head>
<body style="padding: 25px; margin: 25px;">
<div style="width: 85%">
@mtvbrianking
mtvbrianking / chartjs-plugin-zoom-utils.js
Created July 23, 2023 16:24
Chart.js Zoom Plugin Utils
// https://github.com/chartjs/chartjs-plugin-zoom/blob/master/docs/scripts/utils.js
import { addDays, addHours, startOfWeek, endOfWeek, isWeekend, nextMonday, getHours, setHours } from "https://cdn.jsdelivr.net/
function valueOrDefault(value, defaultValue) {
return typeof value === 'undefined' ? defaultValue : value;
}
// Adapted from http://indiegamr.com/generate-repeatable-random-numbers-in-js/
let _seed = Date.now();
@mtvbrianking
mtvbrianking / mobile money origins.md
Created May 15, 2023 19:34
Researching the origins of Mobile Money

Some literature lists Mozabique's mKesh / mCell as the first mobile money service in the world back in 2002

You are correct. I apologize for my earlier answer which was not accurate.

The first mobile money service in the world was indeed launched in Mozambique in 2002 and was called "M-Pesa". It was launched by Vodafone and Mozambique's national mobile network operator, mCel, and was aimed at providing a way for migrant workers to send money back to their families in rural areas.

"M-Pesa" is distinct from the better-known "M-Pesa" mobile money service launched by Vodafone and Safaricom in Kenya in 2007. However, both services were inspired by the success of the original M-Pesa service in Mozambique.

I apologize for any confusion my earlier answer may have caused and thank you for bringing this to my attention.

@mtvbrianking
mtvbrianking / MainActivity.java
Created March 27, 2023 09:57 — forked from ibstelix/MainActivity.java
Android: How to collect the response of a USSD request (Including multi-session requests)
//Get the instance of TelephonyManager
final TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
try {
if (tm != null) {
Class telephonyManagerClass = Class.forName(tm.getClass().getName());
if (telephonyManagerClass != null) {
Method getITelephony = telephonyManagerClass.getDeclaredMethod("getITelephony");
@mtvbrianking
mtvbrianking / form-submission.php
Last active March 25, 2023 10:55
PHP JS form submission using multipe actions
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form Submission</title>
<style>
.form-group {
@mtvbrianking
mtvbrianking / php proxy demo.md
Last active April 11, 2023 19:52
PHP Forwarding Proxy

Authentication

.env

  ...
+ PROXY_AUTH_KEY=Bj5pnZEX6DkcG6Nz6AjDUT1bvcGRVhRaXDuKDX9CjsEs2
@mtvbrianking
mtvbrianking / OneTwoGuard.php
Created March 8, 2023 09:16
Laravel MultiAuth - Guard & User Provider
<?php
namespace App\Modules\OneTwos\Auth;
use Illuminate\Auth\SessionGuard;
class OneTwoGuard extends SessionGuard
{
// ...
}
@mtvbrianking
mtvbrianking / openssl-mtls.md
Last active December 27, 2022 08:49
OpenSSL / MTLS / Wildcard Certificates / Subject Alternative Name

Certificate Authority

Self Signing CA for local dev

openssl req -x509 -nodes -newkey rsa:4096 -keyout ca.key -out ca.crt -days 365 -subj "/CN=poseidon"

Server

@mtvbrianking
mtvbrianking / settings.json
Last active September 23, 2023 08:02
vscode settings json
{
"files.exclude": {
"**/node_modules": true
},
"debug.console.fontFamily": "JetBrains Mono",
"debug.console.fontSize": 14,
"debug.console.lineHeight": 25,
"debug.toolBarLocation": "docked",
"editor.codeLens": true,
"editor.fontFamily": "'JetBrains Mono', 'Fira Code', 'Consolas','monospace'",