Skip to content

Instantly share code, notes, and snippets.

View d1dee's full-sized avatar

d1dee d1dee

View GitHub Profile
@d1dee
d1dee / ke_phone_numbers.js
Created August 8, 2023 14:40
Kenya phone numbers Regex
let phoneNumberRegex = new RegExp(/^(\+254|0)(7[0-9]|1[0-1])[0-9][0-9]{6}$/)
@d1dee
d1dee / kenyan_secondary_schools_subjects.json
Created August 8, 2023 14:23
JSON file with all KNEC subject offered in Kenyan secondary schools
[
{
"name": "English",
"code": "101"
},
{
"name": "Kiswahili",
"code": "102"
},
{
@d1dee
d1dee / kenyan_county_and_subcounties.json
Created January 23, 2023 19:02
Complete json list of all Kenyan counties and their respective sub counties, headquarters and county numbers
[
{
"name": "Mombasa",
"code": 1,
"capital": "Mombasa City",
"subCounties": [ "Changamwe", "Jomvu", "Kisauni", "Likoni", "Mvita", "Nyali" ]
},
{
"name": "Kwale",
"code": 2,
@d1dee
d1dee / county_and_subcounty_name_to_nemis_number
Last active February 5, 2023 14:17
Converts Kenyan Counties and sub counties to their respective code using Regex
export const countyToNo= (county: string, subCounty: string): object => {
county = String(county).trim()
subCounty = String(subCounty).trim()
let countyNo: number;
let subCountyNo: number;
switch (true) {
//Regex county names to avoid typos
//01 Mombasa
case /^momb.*/gi.test(county):
countyNo = 101;