Skip to content

Instantly share code, notes, and snippets.

💭
I'm Feeling Lucky!

Moses Ndeda ratatatKE

💭
I'm Feeling Lucky!
  • Kenya
Block or report user

Report or block ratatatKE

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@NimzyMaina
NimzyMaina / kra_pin_regex.php
Last active Jun 21, 2019
Regex to validate KRA PIN
View kra_pin_regex.php
<?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";
}
@muya
muya / random_saf_ke_msisdn_faker.php
Last active Apr 6, 2017
Code for creating random Safaricom Kenya Phone numbers (accompanying blog post: https://blog.muya.co.ke/random-safaricom-kenya-phone-numbers/)
View random_saf_ke_msisdn_faker.php
<?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);
@muya
muya / msisdn_regex.txt
Created Feb 28, 2016
Regex for Safaricom Kenya, Airtel Kenya & Tigo Tanzania Phone Numbers
View msisdn_regex.txt
# 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/"
@lesiki
lesiki / fsmswebconnection.php
Last active Apr 24, 2019
PHP sample code for sending SMS through the FrontlineCloud API
View fsmswebconnection.php
<?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(
You can’t perform that action at this time.