Skip to content

Instantly share code, notes, and snippets.

View ratatatKE's full-sized avatar
💭
I'm Feeling Lucky!

Moses Ndeda ratatatKE

💭
I'm Feeling Lucky!
View GitHub Profile
@loonies
loonies / 1_phpunit-api.md
Last active September 24, 2024 14:55
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this->anything()
@lesiki
lesiki / fsmswebconnection.php
Last active January 1, 2024 02:58
PHP sample code for sending SMS through the FrontlineCloud API
<?php //FILE: sms_api.php
function sendSMS($number, $message) {
$url = "example"; // Set your frontlinesms or frontlinecloud webconnection url here
$secret = "secret"; // Set the secret here
$request = array(
'secret' => $secret,
'message' => $message,
'recipients' => array(array(
@muya
muya / msisdn_regex.txt
Created February 28, 2016 16:06
Regex for Safaricom Kenya, Airtel Kenya & Tigo Tanzania Phone Numbers
# KE
SAFARICOM: "/(\+?254|0|^){1}[-. ]?[7]{1}([0-2]{1}[0-9]{1}|[9]{1}[0-2]{1})[0-9]{6}\z/"
AIRTEL: "/(\+254|0|^){1}[-. ]?[7]{1}([3]{1}[0-9]{1}|[8]{1}[5-9])[0-9]{6}\z/"
# TZ
TIGO: "/(\+?255|0|^){1}[-. ]?([7]{1}[1]{1}[2-9]{1}|[6]{1}[57]{1}[2-9]{1})[0-9]{6}\z/"
@muya
muya / random_saf_ke_msisdn_faker.php
Last active October 8, 2020 16:41
Code for creating random Safaricom Kenya Phone numbers (accompanying blog post: https://blog.muya.co.ke/random-safaricom-kenya-phone-numbers/)
<?php
// include Faker in your project (https://github.com/fzaninotto/Faker#installation)
use Faker\Factory as Faker;
$faker = Faker::create();
$regex = "/(\+?254|0){1}[7]{1}([0-2]{1}[0-9]{1}|[9]{1}[0-2]{1})[0-9]{6}/";
$samplePhoneNumber = $faker->regexify($regex);
@shov
shov / links.txt
Created January 22, 2019 12:57
XDebug on laradock
@NimzyMaina
NimzyMaina / kra_pin_regex.php
Last active November 22, 2023 08:31
Regex to validate KRA PIN
<?php
$kra_regex = "/^[A]{1}[0-9]{9}[a-zA-Z]{1}$/";
$kra_pin = "A001234567J";
if(preg_match($kra_regex, $kra_pin)){
echo "Success! Valid KRA PIN";
}
else{
echo "Error! Invalid KRA PIN";
}